add handling for pilots with SP #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Module CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# Get the version from 'module.json' | |
- name: Get Version | |
shell: bash | |
id: get-version | |
run: echo "::set-output name=version::$(node ./.github/workflows/get-version.js)" | |
# Get the name from 'module.json' | |
- name: Get Includes | |
shell: bash | |
id: get-includes | |
run: echo "::set-output name=files::$(node ./.github/workflows/get-includes.js)" | |
# create a zip file with all files required by the module to add to the release | |
- name: Zip Files | |
working-directory: ./src #SORRY BUT YOU HAVE TO USE src JUST LIKE GET OVER IT OR FIGURE OUT A BETTER WAY | |
run: zip -r ../module.zip ${{steps.get-includes.outputs.files}} | |
#Useful only for the template so we can leave the manifest and download urls empty | |
- name: Substitute Manifest and Download Links For Versioned Ones | |
id: sub_manifest_link_latest | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: './src/module.json' | |
env: | |
url: https://github.com/${{github.repository}} | |
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json | |
download: https://github.com/${{github.repository}}/releases/latest/download/module.zip | |
# Update the 'latest' release | |
- name: Update Latest Release | |
id: create_latest_release | |
uses: ncipollo/release-action@v1 | |
if: endsWith(github.ref, 'main') | |
with: | |
allowUpdates: true | |
name: Latest | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: './src/module.json, ./module.zip' | |
tag: latest | |
#Substitute the Manifest and Download URLs in the module.json | |
- name: Substitute Manifest and Download Links For Versioned Ones | |
id: sub_manifest_link_version | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: './src/module.json' | |
env: | |
url: https://github.com/${{github.repository}} | |
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json | |
download: https://github.com/${{github.repository}}/releases/download/${{steps.get-version.outputs.version}}/module.zip | |
# Create a release for this specific version | |
- name: Create Version Release | |
id: create_version_release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true # set this to false if you want to prevent updating existing releases | |
name: Release ${{ steps.get-version.outputs.version }} | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: './src/module.json,./module.zip' | |
tag: ${{ steps.get-version.outputs.version }} |