@@ -15,72 +15,89 @@ The image can be found at GitHub's Container Registry: https://github.com/orgs/E
15
15
``` yaml
16
16
name : Pre-release tasks
17
17
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
21
26
jobs :
22
- export-vars :
27
+ prepare :
23
28
runs-on : ubuntu-latest
24
29
outputs :
30
+ PRERELEASE : ${{ steps.vars.outputs.PRERELEASE }}
31
+ FULLVERSION : ${{ steps.vars.outputs.FULLVERSION }}
25
32
RELEASE_NAME : ${{ steps.vars.outputs.RELEASE_NAME }}
26
- TMP_DIR : ${{ steps.vars.outputs.TMP_DIR }}
33
+ TMPDIR : ${{ steps.vars.outputs.TMPDIR }}
27
34
STRIPPED_ZIP_DIR : ${{ steps.vars.outputs.STRIPPED_ZIP_DIR }}
28
35
STRIPPED_ZIP_NAME : ${{ steps.vars.outputs.STRIPPED_ZIP_NAME }}
29
36
STRIPPED_ZIP : ${{ steps.vars.outputs.STRIPPED_ZIP }}
30
37
steps :
31
- - name : Export variables
38
+ - name : Export vars # Export action environment variables
39
+ id : vars
32
40
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
36
46
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 : ./
42
60
process :
43
61
runs-on : ubuntu-latest
44
- needs : [export-vars ] # define prerequisite jobs
62
+ needs : [prepare ] # Define prerequisite jobs
45
63
outputs :
46
- # output-example: # define an output
64
+ METADATA : ${{ steps.metadata.outputs.METADATA }} # Define an output
47
65
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
49
67
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
51
72
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
66
93
with :
67
94
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
71
98
with :
72
99
name : stripped-directory
73
100
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
84
101
` ` `
85
102
86
103
#### More information on Github Action usage can be found at:
0 commit comments