diff --git a/.github/workflows/releases.yaml b/.github/workflows/releases.yaml new file mode 100644 index 000000000..779595c5f --- /dev/null +++ b/.github/workflows/releases.yaml @@ -0,0 +1,73 @@ +name: Releases + +on: + push: + branches: + - liljx + +jobs: + get-releases: + name: Get releases + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Get releases + id: get-releases + run: | + # Get releases. + releases=(azure/v*/release.yaml capa/v*/release.yaml) + releases="$(jq --null-input --args '$ARGS.positional' --compact-output -- ${releases:h})" + + # Store releases. + echo releases="${releases}" >> "${GITHUB_OUTPUT}" + - name: Print releases + env: + releases: ${{ steps.get-releases.outputs.releases }} + run: echo "${releases}" + + outputs: + releases: ${{ steps.get-releases.outputs.releases }} + + create-release: + name: Create release + runs-on: ubuntu-latest + needs: get-releases + + strategy: + matrix: + release: ${{ fromJSON(needs.get-releases.outputs.releases) }} + + steps: + - name: Print release + env: + release: ${{ matrix.release }} + run: echo "${release}" + - name: Split release + id: split-release + env: + release: ${{ matrix.release }} + run: | + # Get provider. + provider="${release:h1}" + + # Switch release. + case "${provider}" in + capa) + provider="aws" + ;; + esac + + # Get version. + version="${release:t1}" + + # Store provider & version. + echo provider="${provider}" >> "${GITHUB_OUTPUT}" + echo version="${version}" >> "${GITHUB_OUTPUT}" + - name: Print provider & version + env: + provider: ${{ steps.split-release.outputs.provider }} + version: ${{ steps.split-release.outputs.version }} + run: | + echo "Provider: ${provider} | Version: ${version}"