2022-11-29 10:58:22 -05:00
|
|
|
name: Make updated OS images available on release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: "Semantic version tag of the release (vX.Y.Z)."
|
|
|
|
required: true
|
2022-12-09 05:51:38 -05:00
|
|
|
latest:
|
|
|
|
description: "Whether to update the latest tag."
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2022-11-29 10:58:22 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
update:
|
|
|
|
runs-on: ubuntu-22.04
|
2023-04-14 12:04:03 -04:00
|
|
|
outputs:
|
|
|
|
latest: ${{ steps.input-passthrough.outputs.latest }}${{ steps.check-last-release.outputs.latest }}
|
2022-11-29 10:58:22 -05:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-05-05 08:42:20 -04:00
|
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-11-29 10:58:22 -05:00
|
|
|
with:
|
2022-12-19 09:21:28 -05:00
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
2022-11-29 10:58:22 -05:00
|
|
|
|
2023-01-11 05:40:27 -05:00
|
|
|
- name: Override latest
|
|
|
|
if: github.event.inputs.latest == 'true'
|
2023-04-14 12:04:03 -04:00
|
|
|
id: input-passthrough
|
|
|
|
run: echo "latest=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-11 05:40:27 -05:00
|
|
|
|
|
|
|
- name: Check if should mark latest
|
|
|
|
if: github.event.inputs.latest != 'true'
|
2023-04-14 12:04:03 -04:00
|
|
|
id: check-last-release
|
2023-01-11 05:40:27 -05:00
|
|
|
env:
|
2023-04-14 12:04:03 -04:00
|
|
|
REPO: edgelesssys/constellation
|
2023-01-11 05:40:27 -05:00
|
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
2023-04-14 12:04:03 -04:00
|
|
|
latest_release_tag=$(
|
|
|
|
gh api \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
|
|
|
"/repos/${REPO}/releases/latest" \
|
|
|
|
| jq -r '.tag_name'
|
|
|
|
)
|
|
|
|
|
|
|
|
current_tag=${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
2023-01-11 05:40:27 -05:00
|
|
|
echo "Latest release tag: ${latest_release_tag}"
|
2023-04-14 12:04:03 -04:00
|
|
|
echo "Current tag: ${current_tag}"
|
|
|
|
|
|
|
|
if [[ "${latest_release_tag}" == "${current_tag}" ]]; then
|
|
|
|
echo "latest=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-11 05:40:27 -05:00
|
|
|
else
|
2023-04-14 12:04:03 -04:00
|
|
|
echo "latest=false" | tee -a "$GITHUB_OUTPUT"
|
2023-01-11 05:40:27 -05:00
|
|
|
fi
|
|
|
|
|
2023-03-10 04:21:58 -05:00
|
|
|
add-image-version-to-versionsapi:
|
|
|
|
needs: [update]
|
|
|
|
name: "Add image version to versionsapi"
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
id-token: write
|
|
|
|
uses: ./.github/workflows/versionsapi.yml
|
|
|
|
with:
|
|
|
|
command: add
|
|
|
|
add_release: true
|
|
|
|
stream: stable
|
2023-04-14 12:04:03 -04:00
|
|
|
version: ${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
2023-03-10 04:21:58 -05:00
|
|
|
kind: image
|
2023-04-14 12:04:03 -04:00
|
|
|
add_latest: ${{ needs.update.outputs.latest == 'true' }}
|
2022-12-30 04:12:48 -05:00
|
|
|
|
2023-03-10 04:21:58 -05:00
|
|
|
add-cli-version-to-versionsapi:
|
2023-04-14 12:04:03 -04:00
|
|
|
needs: [update, add-image-version-to-versionsapi] # run workflow calls after each other
|
2023-03-10 04:21:58 -05:00
|
|
|
name: "Add CLI version to versionsapi"
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
id-token: write
|
|
|
|
uses: ./.github/workflows/versionsapi.yml
|
|
|
|
with:
|
|
|
|
command: add
|
|
|
|
add_release: true
|
|
|
|
stream: stable
|
2023-04-14 12:04:03 -04:00
|
|
|
version: ${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
2023-03-10 04:21:58 -05:00
|
|
|
kind: cli
|
2023-04-14 12:04:03 -04:00
|
|
|
add_latest: ${{ needs.update.outputs.latest == 'true' }}
|