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
|
|
|
|
2023-01-11 05:40:27 -05:00
|
|
|
env:
|
|
|
|
REPO: edgelesssys/constellation
|
|
|
|
TAG: ${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
|
|
|
|
2022-11-29 10:58:22 -05:00
|
|
|
jobs:
|
|
|
|
update:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-01-05 10:17:51 -05:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
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
|
|
|
|
id: override
|
|
|
|
if: github.event.inputs.latest == 'true'
|
|
|
|
run: echo "LATEST=true" >> "$GITHUB_ENV"
|
|
|
|
|
|
|
|
- name: Check if should mark latest
|
|
|
|
if: github.event.inputs.latest != 'true'
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
|
|
|
latest_release_tag=$(gh api \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
|
|
|
"/repos/${REPO}/releases/latest" \
|
|
|
|
| jq -r '.tag_name')
|
|
|
|
echo "Latest release tag: ${latest_release_tag}"
|
|
|
|
echo "Current tag: ${TAG}"
|
|
|
|
if [[ "${latest_release_tag}" == "${TAG}" ]]; then
|
|
|
|
echo "LATEST=true" >> "$GITHUB_ENV"
|
|
|
|
else
|
|
|
|
echo "LATEST=false" >> "$GITHUB_ENV"
|
|
|
|
fi
|
|
|
|
|
2022-11-29 10:58:22 -05:00
|
|
|
- name: Setup Go environment
|
2022-12-14 08:55:14 -05:00
|
|
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
2022-11-29 10:58:22 -05:00
|
|
|
with:
|
2023-03-08 04:05:36 -05:00
|
|
|
go-version: "1.20.2"
|
2022-11-29 10:58:22 -05:00
|
|
|
cache: true
|
|
|
|
|
|
|
|
- name: Login to AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
|
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubAddReleaseVersion
|
|
|
|
aws-region: eu-central-1
|
|
|
|
|
2022-12-30 04:12:48 -05:00
|
|
|
- name: Build versionsapi CLI
|
|
|
|
working-directory: internal/versionsapi/cli
|
|
|
|
run: go build -o versionsapi
|
|
|
|
|
|
|
|
- name: Add version to versionsapi
|
|
|
|
working-directory: internal/versionsapi/cli
|
2022-11-29 10:58:22 -05:00
|
|
|
run: |
|
2023-01-11 05:40:27 -05:00
|
|
|
latest_flag=$([[ "${LATEST}" = "true" ]] && echo "--latest" || echo "")
|
2022-12-30 04:12:48 -05:00
|
|
|
./versionsapi add \
|
2022-12-09 05:51:38 -05:00
|
|
|
--release \
|
2022-12-30 04:12:48 -05:00
|
|
|
--stream "stable" \
|
2023-01-11 05:40:27 -05:00
|
|
|
--version "${TAG}" \
|
|
|
|
"${latest_flag}"
|