2023-01-02 06:25:17 -05:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: "Version to release (e.g. v1.2.3)"
|
|
|
|
required: true
|
|
|
|
kind:
|
|
|
|
description: "Release kind"
|
|
|
|
type: choice
|
|
|
|
options: [minor, patch]
|
|
|
|
required: true
|
|
|
|
default: "minor"
|
|
|
|
|
2023-08-28 03:21:25 -04:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2023-01-02 06:25:17 -05:00
|
|
|
jobs:
|
|
|
|
verify-inputs:
|
|
|
|
name: Verify inputs
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
env:
|
|
|
|
FULL_VERSION: ${{ inputs.version }}
|
|
|
|
outputs:
|
|
|
|
WITHOUT_V: ${{ steps.version-info.outputs.WITHOUT_V }}
|
|
|
|
PART_MAJOR: ${{ steps.version-info.outputs.PART_MAJOR }}
|
|
|
|
PART_MINOR: ${{ steps.version-info.outputs.PART_MINOR }}
|
|
|
|
PART_PATCH: ${{ steps.version-info.outputs.PART_PATCH }}
|
|
|
|
MAJOR: ${{ steps.version-info.outputs.MAJOR }}
|
|
|
|
MAJOR_MINOR: ${{ steps.version-info.outputs.MAJOR_MINOR }}
|
|
|
|
MAJOR_MINOR_PATCH: ${{ steps.version-info.outputs.MAJOR_MINOR_PATCH }}
|
|
|
|
RELEASE_BRANCH: ${{ steps.version-info.outputs.RELEASE_BRANCH }}
|
2023-05-25 04:14:42 -04:00
|
|
|
WORKING_BRANCH: ${{ steps.version-info.outputs.WORKING_BRANCH }}
|
2023-01-02 06:25:17 -05:00
|
|
|
steps:
|
2024-06-19 09:19:41 -04:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-05-25 04:14:42 -04:00
|
|
|
|
|
|
|
- name: Working branch
|
|
|
|
run: echo "WORKING_BRANCH=$(git branch --show-current)" | tee -a "$GITHUB_ENV"
|
|
|
|
|
2023-01-02 06:25:17 -05:00
|
|
|
- name: Verify version
|
|
|
|
run: |
|
|
|
|
if [[ ! "${FULL_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
echo "Version must be in the form of vX.Y.Z"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2023-05-25 04:14:42 -04:00
|
|
|
- name: Verify temporary branch
|
|
|
|
run: |
|
2023-08-28 03:21:25 -04:00
|
|
|
if [[ ! "${WORKING_BRANCH}" =~ ^tmp/v[0-9]+\.[0-9]+\.[0-9] ]]; then
|
|
|
|
echo "Workflow can only be triggered from a temporary branch in the form of tmp/vX.Y.Z"
|
2023-05-25 04:14:42 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-01-02 06:25:17 -05:00
|
|
|
- name: Extract version info
|
|
|
|
id: version-info
|
|
|
|
run: |
|
|
|
|
WITHOUT_V=${FULL_VERSION#v}
|
|
|
|
PART_MAJOR=${WITHOUT_V%%.*}
|
|
|
|
PART_MINOR=${WITHOUT_V#*.}
|
|
|
|
PART_MINOR=${PART_MINOR%%.*}
|
|
|
|
PART_PATCH=${WITHOUT_V##*.}
|
|
|
|
{
|
|
|
|
echo "WITHOUT_V=${WITHOUT_V}"
|
|
|
|
echo "PART_MAJOR=${PART_MAJOR}"
|
|
|
|
echo "PART_MINOR=${PART_MINOR}"
|
|
|
|
echo "PART_PATCH=${PART_PATCH}"
|
|
|
|
echo "MAJOR=${PART_MAJOR}"
|
|
|
|
echo "MAJOR_MINOR=${PART_MAJOR}.${PART_MINOR}"
|
|
|
|
echo "MAJOR_MINOR_PATCH=${PART_MAJOR}.${PART_MINOR}.${PART_PATCH}"
|
|
|
|
echo "RELEASE_BRANCH=release/v${PART_MAJOR}.${PART_MINOR}"
|
2023-05-25 04:14:42 -04:00
|
|
|
echo "WORKING_BRANCH=${WORKING_BRANCH}"
|
2023-03-21 07:20:27 -04:00
|
|
|
} | tee -a "$GITHUB_OUTPUT"
|
2023-01-02 06:25:17 -05:00
|
|
|
|
2023-01-06 05:49:55 -05:00
|
|
|
docs:
|
2023-05-25 04:14:42 -04:00
|
|
|
name: Create docs release (from main)
|
2023-01-06 05:49:55 -05:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
if: inputs.kind == 'minor'
|
|
|
|
needs: verify-inputs
|
2023-01-30 10:11:27 -05:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-02-27 04:49:52 -05:00
|
|
|
pull-requests: write
|
2023-01-06 05:49:55 -05:00
|
|
|
env:
|
|
|
|
VERSION: ${{ inputs.version }}
|
|
|
|
MAJOR_MINOR: ${{ needs.verify-inputs.outputs.MAJOR_MINOR }}
|
|
|
|
BRANCH: docs/${{ needs.verify-inputs.outputs.MAJOR_MINOR }}
|
|
|
|
steps:
|
2024-06-19 09:19:41 -04:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-01-06 05:49:55 -05:00
|
|
|
with:
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: main
|
2023-01-12 12:13:25 -05:00
|
|
|
|
2023-01-06 05:49:55 -05:00
|
|
|
- name: Create docs release
|
|
|
|
working-directory: docs
|
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
npm run docusaurus docs:version "${MAJOR_MINOR}"
|
2023-01-12 12:13:25 -05:00
|
|
|
|
2023-01-06 05:49:55 -05:00
|
|
|
- name: Create docs pull request
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
|
2023-01-06 05:49:55 -05:00
|
|
|
with:
|
2023-01-26 06:13:10 -05:00
|
|
|
branch: ${{ env.BRANCH }}
|
2023-01-24 12:52:41 -05:00
|
|
|
base: main
|
2023-01-26 06:13:10 -05:00
|
|
|
title: "docs: add release ${{ env.VERSION }}"
|
2023-01-24 12:52:41 -05:00
|
|
|
body: |
|
2023-01-06 05:49:55 -05:00
|
|
|
:robot: *This is an automated PR.* :robot:
|
2023-01-12 12:13:25 -05:00
|
|
|
|
2023-01-26 06:13:10 -05:00
|
|
|
The PR is triggered as part of the automated release process of version ${{ env.VERSION }}.
|
2023-01-12 12:13:25 -05:00
|
|
|
It releases a new version of the documentation.
|
2023-01-26 06:13:10 -05:00
|
|
|
commit-message: "docs: add release ${{ env.VERSION }}"
|
2023-01-24 12:52:41 -05:00
|
|
|
committer: edgelessci <edgelessci@users.noreply.github.com>
|
2023-01-26 09:29:20 -05:00
|
|
|
labels: no changelog
|
2023-02-27 09:16:07 -05:00
|
|
|
# We need to push changes using a token, otherwise triggers like on:push and on:pull_request won't work.
|
2023-03-02 12:07:29 -05:00
|
|
|
token: ${{ !github.event.pull_request.head.repo.fork && secrets.CI_COMMIT_PUSH_PR || '' }}
|
2023-01-06 05:49:55 -05:00
|
|
|
|
2023-05-25 04:14:42 -04:00
|
|
|
check-working-branch:
|
|
|
|
name: Check temporary working branch
|
2023-01-02 06:25:17 -05:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
needs: verify-inputs
|
2023-01-30 10:11:27 -05:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-01-02 06:25:17 -05:00
|
|
|
env:
|
2023-05-25 04:14:42 -04:00
|
|
|
RELEASE_BRANCH: ${{ needs.verify-inputs.outputs.RELEASE_BRANCH }}
|
|
|
|
WORKING_BRANCH: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-01-02 06:25:17 -05:00
|
|
|
steps:
|
2023-01-18 04:15:58 -05:00
|
|
|
- name: Checkout
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-01-02 06:25:17 -05:00
|
|
|
with:
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2023-05-25 04:14:42 -04:00
|
|
|
- name: Check if we are strictly ahead of the release branch (if it exists)
|
2023-01-02 06:25:17 -05:00
|
|
|
run: |
|
|
|
|
git fetch
|
|
|
|
git pull
|
2023-05-25 04:14:42 -04:00
|
|
|
git checkout "${RELEASE_BRANCH}" || exit 0
|
|
|
|
git checkout "${WORKING_BRANCH}"
|
|
|
|
ahead=$(git rev-list HEAD --not "${RELEASE_BRANCH}" | wc -l)
|
2023-07-19 11:48:29 -04:00
|
|
|
if [[ "${ahead}" -eq 0 ]]; then
|
2023-05-25 04:14:42 -04:00
|
|
|
echo "The current branch is not strictly ahead of the release branch. Please rebase."
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-01-02 06:25:17 -05:00
|
|
|
|
2023-03-31 06:41:32 -04:00
|
|
|
- name: Write version to version.txt
|
|
|
|
run: |
|
2023-05-25 04:14:42 -04:00
|
|
|
git checkout "${WORKING_BRANCH}"
|
2023-03-31 06:41:32 -04:00
|
|
|
echo "${{ inputs.version }}" > version.txt
|
2023-04-14 12:53:50 -04:00
|
|
|
git config --global user.name "edgelessci"
|
|
|
|
git config --global user.email "edgelessci@users.noreply.github.com"
|
2023-03-31 06:41:32 -04:00
|
|
|
git add version.txt
|
2023-03-31 09:41:32 -04:00
|
|
|
git diff --staged --quiet || git commit -m "chore: update version.txt to ${{ inputs.version }}"
|
2023-05-25 04:14:42 -04:00
|
|
|
git push origin "${WORKING_BRANCH}"
|
2023-03-31 06:41:32 -04:00
|
|
|
|
2023-01-02 06:25:17 -05:00
|
|
|
update-versions:
|
2023-01-05 08:36:30 -05:00
|
|
|
name: Update container image versions
|
2023-05-25 04:14:42 -04:00
|
|
|
needs: [verify-inputs, check-working-branch]
|
2023-01-02 06:25:17 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2023-01-30 10:11:27 -05:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-02-27 04:49:52 -05:00
|
|
|
packages: read
|
2023-01-02 06:25:17 -05:00
|
|
|
env:
|
|
|
|
VERSION: ${{ inputs.version }}
|
|
|
|
WITHOUT_V: ${{ needs.verify-inputs.outputs.WITHOUT_V }}
|
|
|
|
steps:
|
2023-01-18 04:15:58 -05:00
|
|
|
- name: Checkout
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-01-02 06:25:17 -05:00
|
|
|
with:
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-01-02 06:25:17 -05:00
|
|
|
|
|
|
|
- name: Update enterprise image version
|
|
|
|
run: |
|
2023-05-22 03:22:00 -04:00
|
|
|
defaultVersionReg='defaultImage = \"[^\"]*\"'
|
|
|
|
|
|
|
|
# Ensure regexp matches (otherwise the file was changed or the workflow is broken).
|
2023-05-23 04:49:47 -04:00
|
|
|
grep -E "${defaultVersionReg}" internal/config/image_enterprise.go
|
2023-05-22 03:22:00 -04:00
|
|
|
|
|
|
|
# Update version.
|
2023-05-23 04:49:47 -04:00
|
|
|
sed -i "s/${defaultVersionReg}/defaultImage = \"${VERSION}\"/" internal/config/image_enterprise.go
|
|
|
|
git add internal/config/image_enterprise.go
|
2023-10-27 10:16:31 -04:00
|
|
|
|
|
|
|
- name: Update s3proxy Chart version
|
|
|
|
run: |
|
|
|
|
yq eval -i ".version = \"$WITHOUT_V\"" s3proxy/deploy/s3proxy/Chart.yaml
|
|
|
|
yq eval -i ".image = \"ghcr.io/edgelesssys/constellation/s3proxy:$VERSION\"" s3proxy/deploy/s3proxy/values.yaml
|
|
|
|
|
2024-05-14 09:45:06 -04:00
|
|
|
git add s3proxy/deploy/s3proxy/Chart.yaml s3proxy/deploy/s3proxy/values.yaml
|
2023-10-27 10:16:31 -04:00
|
|
|
|
2023-01-02 06:25:17 -05:00
|
|
|
- name: Commit
|
|
|
|
run: |
|
2023-04-14 12:53:50 -04:00
|
|
|
git config --global user.name "edgelessci"
|
|
|
|
git config --global user.email "edgelessci@users.noreply.github.com"
|
2023-08-28 03:21:25 -04:00
|
|
|
if git diff-index --quiet HEAD --; then
|
|
|
|
echo "No changes to commit"
|
|
|
|
else
|
2023-10-27 10:16:31 -04:00
|
|
|
git commit -m "deps: update versions to ${VERSION}"
|
2023-08-28 03:21:25 -04:00
|
|
|
git push
|
|
|
|
fi
|
2023-01-02 06:25:17 -05:00
|
|
|
|
2023-11-02 12:45:11 -04:00
|
|
|
- name: Publish s3proxy
|
|
|
|
uses: ./.github/actions/publish_helmchart
|
|
|
|
with:
|
|
|
|
chartPath: ${{ github.workspace }}/s3proxy/deploy/s3proxy
|
|
|
|
githubToken: ${{ secrets.CI_GITHUB_REPOSITORY }}
|
|
|
|
|
2023-01-02 06:25:17 -05:00
|
|
|
os-image:
|
2023-01-05 08:36:30 -05:00
|
|
|
name: Build OS image
|
2023-01-02 06:25:17 -05:00
|
|
|
needs: [verify-inputs, update-versions]
|
|
|
|
uses: ./.github/workflows/build-os-image.yml
|
2023-01-30 10:11:27 -05:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
packages: read
|
2023-01-02 06:25:17 -05:00
|
|
|
secrets: inherit
|
|
|
|
with:
|
|
|
|
imageVersion: ${{ inputs.version }}
|
|
|
|
isRelease: true
|
|
|
|
stream: "stable"
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-01-02 06:25:17 -05:00
|
|
|
|
2023-01-05 08:36:30 -05:00
|
|
|
update-hardcoded-measurements:
|
|
|
|
name: Update hardcoded measurements (in the CLI)
|
2023-02-27 04:49:52 -05:00
|
|
|
needs: [verify-inputs, os-image]
|
2023-01-30 10:11:27 -05:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-01-05 08:36:30 -05:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
env:
|
|
|
|
VERSION: ${{ inputs.version }}
|
|
|
|
WITHOUT_V: ${{ needs.verify-inputs.outputs.WITHOUT_V }}
|
|
|
|
steps:
|
2023-01-18 04:15:58 -05:00
|
|
|
- name: Checkout
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-01-05 08:36:30 -05:00
|
|
|
with:
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-01-05 08:36:30 -05:00
|
|
|
|
|
|
|
- name: Setup Go environment
|
2024-07-18 02:49:57 -04:00
|
|
|
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
|
2023-01-05 08:36:30 -05:00
|
|
|
with:
|
2024-09-09 06:45:48 -04:00
|
|
|
go-version: "1.22.7"
|
2023-01-05 08:36:30 -05:00
|
|
|
cache: true
|
|
|
|
|
|
|
|
- name: Build generateMeasurements tool
|
|
|
|
working-directory: internal/attestation/measurements/measurement-generator
|
|
|
|
run: go build -o generate -tags=enterprise .
|
|
|
|
|
|
|
|
- name: Update hardcoded measurements
|
|
|
|
working-directory: internal/attestation/measurements
|
|
|
|
run: |
|
|
|
|
./measurement-generator/generate
|
|
|
|
git add measurements_enterprise.go
|
|
|
|
|
|
|
|
- name: Commit
|
|
|
|
run: |
|
2023-04-14 12:53:50 -04:00
|
|
|
git config --global user.name "edgelessci"
|
|
|
|
git config --global user.email "edgelessci@users.noreply.github.com"
|
2024-07-02 03:12:46 -04:00
|
|
|
if git diff-index --quiet HEAD --; then
|
|
|
|
echo "No changes to commit"
|
|
|
|
else
|
|
|
|
git commit -m "attestation: hardcode measurements for ${VERSION}"
|
|
|
|
git push
|
|
|
|
fi
|
2023-01-06 05:49:55 -05:00
|
|
|
|
2023-12-11 09:00:08 -05:00
|
|
|
draft-release:
|
2023-01-06 05:49:55 -05:00
|
|
|
name: Draft release (CLI)
|
2023-09-07 02:47:01 -04:00
|
|
|
needs: [verify-inputs, update-hardcoded-measurements]
|
2023-12-11 09:00:08 -05:00
|
|
|
uses: ./.github/workflows/draft-release.yml
|
2023-01-30 10:11:27 -05:00
|
|
|
permissions:
|
|
|
|
actions: read
|
|
|
|
contents: write
|
|
|
|
id-token: write
|
2023-04-04 04:16:04 -04:00
|
|
|
packages: write
|
2023-01-06 05:49:55 -05:00
|
|
|
secrets: inherit
|
|
|
|
with:
|
2023-09-07 02:47:01 -04:00
|
|
|
versionName: ${{ inputs.version }}
|
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-05-22 03:22:00 -04:00
|
|
|
pushContainers: true
|
2023-06-14 03:56:11 -04:00
|
|
|
key: 'release'
|
2023-05-22 03:22:00 -04:00
|
|
|
|
|
|
|
e2e-tests:
|
|
|
|
name: Run E2E tests
|
2023-12-11 09:00:08 -05:00
|
|
|
needs: [verify-inputs, draft-release]
|
2023-05-22 03:22:00 -04:00
|
|
|
uses: ./.github/workflows/e2e-test-release.yml
|
|
|
|
permissions:
|
|
|
|
checks: write
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
2024-07-01 10:23:53 -04:00
|
|
|
actions: write
|
2023-05-22 03:22:00 -04:00
|
|
|
secrets: inherit
|
|
|
|
with:
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|
2023-06-05 07:56:16 -04:00
|
|
|
targetVersion: ${{ inputs.version }}
|
2023-05-22 03:22:00 -04:00
|
|
|
|
|
|
|
mini-e2e:
|
|
|
|
name: Run mini E2E tests
|
2023-12-11 09:00:08 -05:00
|
|
|
needs: [verify-inputs, draft-release]
|
2023-05-22 03:22:00 -04:00
|
|
|
uses: ./.github/workflows/e2e-mini.yml
|
|
|
|
permissions:
|
|
|
|
checks: write
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
secrets: inherit
|
|
|
|
with:
|
2023-05-25 04:14:42 -04:00
|
|
|
ref: ${{ needs.verify-inputs.outputs.WORKING_BRANCH }}
|