|
| 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@v2 |
| 12 | + |
| 13 | + # get part of the tag after the `v` |
| 14 | + - name: Extract tag version number |
| 15 | + id: get_version |
| 16 | + uses: battila7/get-version-action@v2 |
| 17 | + |
| 18 | + # Substitute the Manifest and Download URLs in the module.json |
| 19 | + - name: Substitute Manifest and Download Links For Versioned Ones |
| 20 | + id: sub_manifest_link_version |
| 21 | + uses: microsoft/variable-substitution@v1 |
| 22 | + with: |
| 23 | + files: 'module.json' |
| 24 | + env: |
| 25 | + version: ${{steps.get_version.outputs.version-without-v}} |
| 26 | + url: https://github.com/${{github.repository}} |
| 27 | + manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json |
| 28 | + download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip |
| 29 | + |
| 30 | + # Create a zip file with all files required by the module to add to the release |
| 31 | + - run: zip -r ./module.zip module.json README.md LICENSE packs/ |
| 32 | + |
| 33 | + # Create a release for this specific version |
| 34 | + - name: Update Release with Files |
| 35 | + id: create_version_release |
| 36 | + uses: ncipollo/release-action@v1 |
| 37 | + with: |
| 38 | + allowUpdates: true # Set this to false if you want to prevent updating existing releases |
| 39 | + name: ${{ github.event.release.name }} |
| 40 | + draft: ${{ github.event.release.unpublished }} |
| 41 | + prerelease: ${{ github.event.release.prerelease }} |
| 42 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + artifacts: './module.json, ./module.zip' |
| 44 | + tag: ${{ github.event.release.tag_name }} |
| 45 | + body: ${{ github.event.release.body }} |
0 commit comments