|
| 1 | +name: Release Creation |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + |
| 13 | + #Substitute the Manifest and Download URLs in the module.json |
| 14 | + - name: Substitute Manifest and Download Links For Versioned Ones |
| 15 | + id: sub_release_manifest_version |
| 16 | + uses: microsoft/variable-substitution@v1 |
| 17 | + with: |
| 18 | + files: "module.json" |
| 19 | + env: |
| 20 | + version: ${{github.event.release.tag_name}} |
| 21 | + url: https://github.com/${{github.repository}} |
| 22 | + manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json |
| 23 | + download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/master.zip |
| 24 | + |
| 25 | + # create a zip file with all files required by the module to add to the release |
| 26 | + - run: zip -r ./master.zip module.json readme.md t ui/ scripts/ languages/ |
| 27 | + |
| 28 | + # Create a release for this specific version |
| 29 | + - name: Update Release with Files |
| 30 | + id: create_version_release |
| 31 | + uses: ncipollo/release-action@v1 |
| 32 | + with: |
| 33 | + allowUpdates: true # set this to false if you want to prevent updating existing releases |
| 34 | + name: ${{ github.event.release.name }} |
| 35 | + draft: false |
| 36 | + prerelease: false |
| 37 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + artifacts: "./module.json, ./master.zip" |
| 39 | + tag: ${{ github.event.release.tag_name }} |
| 40 | + body: ${{ github.event.release.body }} |
| 41 | + |
| 42 | + # Update the 'latest' release |
| 43 | + - name: Create Release |
| 44 | + id: create_latest_release |
| 45 | + uses: ncipollo/release-action@v1 |
| 46 | + if: endsWith(github.ref, 'master') |
| 47 | + with: |
| 48 | + allowUpdates: true |
| 49 | + name: Latest |
| 50 | + draft: false |
| 51 | + prerelease: false |
| 52 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + artifacts: "./module.json,./master.zip" |
| 54 | + tag: latest |
| 55 | + body: ${{ github.event.release.body }} |
0 commit comments