Skip to content

Commit 2387a44

Browse files
committed
Update the example
1 parent 8eaaa36 commit 2387a44

File tree

1 file changed

+62
-45
lines changed

1 file changed

+62
-45
lines changed

README.md

+62-45
Original file line numberDiff line numberDiff line change
@@ -15,72 +15,89 @@ The image can be found at GitHub's Container Registry: https://github.com/orgs/E
1515
```yaml
1616
name: Pre-release tasks
1717
on:
18-
push:
19-
tags:
20-
- 'v*'
18+
workflow_dispatch:
19+
inputs:
20+
PRERELEASE:
21+
required: false
22+
type: string
23+
TAG:
24+
required: true
25+
type: string
2126
jobs:
22-
export-vars:
27+
prepare:
2328
runs-on: ubuntu-latest
2429
outputs:
30+
PRERELEASE: ${{ steps.vars.outputs.PRERELEASE }}
31+
FULLVERSION: ${{ steps.vars.outputs.FULLVERSION }}
2532
RELEASE_NAME: ${{ steps.vars.outputs.RELEASE_NAME }}
26-
TMP_DIR: ${{ steps.vars.outputs.TMP_DIR }}
33+
TMPDIR: ${{ steps.vars.outputs.TMPDIR }}
2734
STRIPPED_ZIP_DIR: ${{ steps.vars.outputs.STRIPPED_ZIP_DIR }}
2835
STRIPPED_ZIP_NAME: ${{ steps.vars.outputs.STRIPPED_ZIP_NAME }}
2936
STRIPPED_ZIP: ${{ steps.vars.outputs.STRIPPED_ZIP }}
3037
steps:
31-
- name: Export variables
38+
- name: Export vars # Export action environment variables
39+
id: vars
3240
run: |
33-
RELEASE_NAME=${{ github.event.repository.name }}-${{ github.ref_name }}
34-
TMP_DIR=/tmp/$RELEASE_NAME-tmp
35-
STRIPPED_ZIP_DIR=$TMP_DIR/to-deliver
41+
echo "PRERELEASE=${{ inputs.PRERELEASE }}" >> $GITHUB_OUTPUT
42+
echo "FULLVERSION=${{ inputs.TAG }}" >> $GITHUB_OUTPUT
43+
RELEASE_NAME=${{ github.event.repository.name }}-${{ inputs.TAG }}
44+
TMPDIR=/tmp/$RELEASE_NAME-tmp
45+
STRIPPED_ZIP_DIR=$TMPDIR/to-deliver
3646
STRIPPED_ZIP_NAME=$RELEASE_NAME.zip
37-
echo "::set-output name=RELEASE_NAME::${{ github.event.repository.name }}-${{ github.ref_name }}"
38-
echo "::set-output name=TMP_DIR::$TMP_DIR"
39-
echo "::set-output name=STRIPPED_ZIP_DIR::$STRIPPED_ZIP_DIR"
40-
echo "::set-output name=STRIPPED_ZIP_NAME::$STRIPPED_ZIP_NAME"
41-
echo "::set-output name=STRIPPED_ZIP::$STRIPPED_ZIP_DIR/$STRIPPED_ZIP_NAME"
47+
echo "RELEASE_NAME=${{ github.event.repository.name }}-${{ inputs.TAG }}" >> $GITHUB_OUTPUT
48+
echo "TMPDIR=$TMPDIR" >> $GITHUB_OUTPUT
49+
echo "STRIPPED_ZIP_DIR=$STRIPPED_ZIP_DIR" >> $GITHUB_OUTPUT
50+
echo "STRIPPED_ZIP_NAME=$STRIPPED_ZIP_NAME" >> $GITHUB_OUTPUT
51+
echo "STRIPPED_ZIP=$STRIPPED_ZIP_DIR/$STRIPPED_ZIP_NAME" >> $GITHUB_OUTPUT
52+
- uses: actions/[email protected] # Upload the clean repository checkout for later use
53+
with:
54+
ref: ${{ inputs.TAG }}
55+
- name: upload repository artifact
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: repository
59+
path: ./
4260
process:
4361
runs-on: ubuntu-latest
44-
needs: [export-vars] # define prerequisite jobs
62+
needs: [prepare] # Define prerequisite jobs
4563
outputs:
46-
# output-example: # define an output
64+
METADATA: ${{ steps.metadata.outputs.METADATA }} # Define an output
4765
container:
48-
image: ghcr.io/exill-suarl/themeforest-automation:latest # it's recommended to use SemVer tags to avoid breaking changes
66+
image: ghcr.io/exill-suarl/themeforest-automation:latest # It's recommended to use SemVer tags to avoid breaking changes
4967
env:
50-
TMP_DIR: ${{ needs.export-vars.outputs.TMP_DIR }}
68+
TMPDIR: ${{ needs.prepare.outputs.TMPDIR }}
69+
defaults:
70+
run:
71+
shell: bash -e {0} # Use Bash as the default Shell for this job
5172
steps:
52-
- name: execute post-run # to update OS packages and install dependencies.
53-
run: post-run.sh
54-
- name: Clone project # clone a repository to process
55-
uses: actions/checkout@v3
56-
- name: Strip files
57-
run: globfile-del.sh ./.itemignore # delete every file/directory that match the defined glob paths in .itemignore
58-
- name: Generate documentation # generate documentation from a markdown file
59-
run: md-to-doc.sh ./documentation.md documentation
60-
- name: Blur ./public # batch-blur images in ./public directory
61-
run: batch-blur.sh ./public
62-
- name: ZIP CWD # export the current working directory as a ZIP
63-
run: dir-zip.sh . ${{ needs.export-vars.outputs.STRIPPED_ZIP_DIR }} ${{ needs.export-vars.outputs.STRIPPED_ZIP_NAME }}
64-
- name: upload stripped ZIP as an artifact
65-
uses: actions/upload-artifact@v3 # upload Artifact
73+
- uses: actions/download-artifact@v3 # Use the previously uploaded repository artifact
74+
with:
75+
name: repository
76+
- name: Import metadata # Parse JSONs for metadata purposes
77+
id: metadata
78+
run: |
79+
METADATA=$(metadata-parser.sh ./package.json ./.devcontainer/config/metadata.json)
80+
echo "METADATA=$METADATA" >> $GITHUB_OUTPUT
81+
- name: Generate documentation # Generate documentation from a markdown file
82+
run: runner md-to-doc.sh '${{ steps.metadata.outputs.METADATA }}' ./documentation.md documentation
83+
- name: Generate dependencies report # Generate dependencies report
84+
run: runner report-deps.sh .devcontainer/config/dependency_decisions.yml ./documentation
85+
- name: Blur /public # Blur all images in the public folder
86+
run: runner batch-blur.sh ./public
87+
- name: Ignore files # Delete every file/directory that matches the defined glob paths in .itemignore
88+
run: runner globfile-del.sh ./.itemignore
89+
- name: ZIP the CWD # Export the current working directory as a ZIP
90+
run: runner dir-zip.sh . ${{ needs.prepare.outputs.STRIPPED_ZIP_DIR }} ${{ needs.prepare.outputs.STRIPPED_ZIP_NAME }}
91+
- name: upload stripped item artifact # Upload for later delivery (as a ZIP file)
92+
uses: actions/upload-artifact@v3
6693
with:
6794
name: stripped-zip
68-
path: ${{ needs.export-vars.outputs.STRIPPED_ZIP }}
69-
- name: upload CWD as an artifact
70-
uses: actions/upload-artifact@v3 # upload Artifact
95+
path: ${{ needs.prepare.outputs.STRIPPED_ZIP }}
96+
- name: upload stripped directory artifact # Upload for later delivery (as a directory)
97+
uses: actions/upload-artifact@v3
7198
with:
7299
name: stripped-directory
73100
path: ./
74-
- name: Send to FTP # upload processed files to an FTP server
75-
uses: SamKirkland/[email protected]
76-
with:
77-
local-dir: './'
78-
dangerous-clean-slate: false
79-
server: ${{ secrets.ftp_delivery_server }}
80-
username: ${{ secrets.ftp_delivery_username }}
81-
password: ${{ secrets.ftp_delivery_password }}
82-
- name: Download Artifact # download all previously uploaded Artifacts
83-
uses: actions/download-artifact@v3
84101
```
85102
86103
#### More information on Github Action usage can be found at:

0 commit comments

Comments
 (0)