mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
ci: fix version publishing on release (#1658)
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
1d0ee796e8
commit
632b24e7cd
58
.github/workflows/on-release.yml
vendored
58
.github/workflows/on-release.yml
vendored
@ -13,16 +13,11 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
env:
|
|
||||||
REPO: edgelesssys/constellation
|
|
||||||
TAG: ${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
permissions:
|
outputs:
|
||||||
id-token: write
|
latest: ${{ steps.input-passthrough.outputs.latest }}${{ steps.check-last-release.outputs.latest }}
|
||||||
contents: read
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
||||||
@ -30,39 +25,34 @@ jobs:
|
|||||||
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
||||||
|
|
||||||
- name: Override latest
|
- name: Override latest
|
||||||
id: override
|
|
||||||
if: github.event.inputs.latest == 'true'
|
if: github.event.inputs.latest == 'true'
|
||||||
run: echo "LATEST=true" >> "$GITHUB_ENV"
|
id: input-passthrough
|
||||||
|
run: echo "latest=true" | tee -a "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Check if should mark latest
|
- name: Check if should mark latest
|
||||||
if: github.event.inputs.latest != 'true'
|
if: github.event.inputs.latest != 'true'
|
||||||
|
id: check-last-release
|
||||||
env:
|
env:
|
||||||
|
REPO: edgelesssys/constellation
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
latest_release_tag=$(gh api \
|
latest_release_tag=$(
|
||||||
-H "Accept: application/vnd.github+json" \
|
gh api \
|
||||||
"/repos/${REPO}/releases/latest" \
|
-H "Accept: application/vnd.github+json" \
|
||||||
| jq -r '.tag_name')
|
"/repos/${REPO}/releases/latest" \
|
||||||
|
| jq -r '.tag_name'
|
||||||
|
)
|
||||||
|
|
||||||
|
current_tag=${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
||||||
echo "Latest release tag: ${latest_release_tag}"
|
echo "Latest release tag: ${latest_release_tag}"
|
||||||
echo "Current tag: ${TAG}"
|
echo "Current tag: ${current_tag}"
|
||||||
if [[ "${latest_release_tag}" == "${TAG}" ]]; then
|
|
||||||
echo "LATEST=true" >> "$GITHUB_ENV"
|
if [[ "${latest_release_tag}" == "${current_tag}" ]]; then
|
||||||
|
echo "latest=true" | tee -a "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "LATEST=false" >> "$GITHUB_ENV"
|
echo "latest=false" | tee -a "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Go environment
|
|
||||||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
|
||||||
with:
|
|
||||||
go-version: "1.20.3"
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- name: Login to AWS
|
|
||||||
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
|
|
||||||
with:
|
|
||||||
role-to-assume: arn:aws:iam::795746500882:role/GithubAddReleaseVersion
|
|
||||||
aws-region: eu-central-1
|
|
||||||
|
|
||||||
add-image-version-to-versionsapi:
|
add-image-version-to-versionsapi:
|
||||||
needs: [update]
|
needs: [update]
|
||||||
name: "Add image version to versionsapi"
|
name: "Add image version to versionsapi"
|
||||||
@ -74,12 +64,12 @@ jobs:
|
|||||||
command: add
|
command: add
|
||||||
add_release: true
|
add_release: true
|
||||||
stream: stable
|
stream: stable
|
||||||
version: ${{ inputs.tag }}
|
version: ${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
||||||
kind: image
|
kind: image
|
||||||
add_latest: true
|
add_latest: ${{ needs.update.outputs.latest == 'true' }}
|
||||||
|
|
||||||
add-cli-version-to-versionsapi:
|
add-cli-version-to-versionsapi:
|
||||||
needs: [update]
|
needs: [update, add-image-version-to-versionsapi] # run workflow calls after each other
|
||||||
name: "Add CLI version to versionsapi"
|
name: "Add CLI version to versionsapi"
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@ -89,6 +79,6 @@ jobs:
|
|||||||
command: add
|
command: add
|
||||||
add_release: true
|
add_release: true
|
||||||
stream: stable
|
stream: stable
|
||||||
version: ${{ inputs.tag }}
|
version: ${{ github.event.release.tag_name }}${{ github.event.inputs.tag }}
|
||||||
kind: cli
|
kind: cli
|
||||||
add_latest: true
|
add_latest: ${{ needs.update.outputs.latest == 'true' }}
|
||||||
|
Loading…
Reference in New Issue
Block a user