chore: update GitHub actions (#596) #375
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Decide between Pre-Release and Development Release | |
name: Release | |
on: | |
push: | |
branches: [main] | |
jobs: | |
e2e-tests-olm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: e2e tests through OLM | |
uses: ./.github/e2e-tests-olm | |
publish-olm-development: | |
if: "!startsWith(github.event.head_commit.message, 'chore(release):')" | |
runs-on: ubuntu-latest | |
environment: quay | |
needs: | |
- e2e-tests-olm | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Bumping the version in the next step will also run code generation scripts | |
# that depend on controller-gen. | |
# Therefore, we first need to setup Go so that we can install the | |
# controller-gen binary. | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Set version | |
id: version | |
run: | | |
npx standard-version --skip.commit --skip.tag --skip.changelog | |
version="$(cat VERSION)-$(date +%y%m%d%H%M%S)" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Publish OLM | |
uses: ./.github/olm-publish | |
env: | |
IMAGE_BASE: ${{ secrets.IMAGE_BASE }} | |
VERSION: ${{ steps.version.outputs.version }} | |
CHANNELS: development | |
RELEASE_SHA: ${GITHUB_SHA} | |
with: | |
quay_login: ${{ secrets.QUAY_LOGIN }} | |
quay_token: ${{ secrets.QUAY_TOKEN }} | |
- name: Push catalog index changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.REPOSITORY_PUSH_TOKEN }} | |
branch: olm-catalog | |
- name: Publish Package | |
uses: ./.github/package-operator-publish | |
env: | |
IMAGE_BASE: ${{ secrets.IMAGE_BASE }} | |
VERSION: ${{ steps.version.outputs.version }} | |
with: | |
quay_login: ${{ secrets.QUAY_LOGIN }} | |
quay_token: ${{ secrets.QUAY_TOKEN }} | |
- name: Publish test harness | |
uses: ./.github/osd-test-harness-publish | |
env: | |
IMAGE_BASE: ${{ secrets.IMAGE_BASE }} | |
VERSION: ${{ steps.version.outputs.version }} | |
with: | |
quay_login: ${{ secrets.QUAY_LOGIN }} | |
quay_token: ${{ secrets.QUAY_TOKEN }} | |
create-github-prerelease: | |
needs: | |
- e2e-tests-olm | |
runs-on: ubuntu-latest | |
if: "startsWith(github.event.head_commit.message, 'chore(release):')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.REPOSITORY_PUSH_TOKEN }} | |
# Bumping the version in the next step will also run code generation scripts | |
# that depend on controller-gen. | |
# Therefore, we first need to setup Go so that we can install the | |
# controller-gen binary. | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Generate release notes | |
run: | | |
# Create the release notes for the Github release | |
git config user.name rhobs-release-bot | |
git config user.email [email protected] | |
npx standard-version -i RELEASE_BODY.md \ | |
--release-as $(cat VERSION) \ | |
--skip.commit | |
- name: Publish tag | |
id: publish_tag | |
run: | | |
# NOTE tag is created by standard-version and points to the | |
# chore(release): commit | |
git push --follow-tags | |
echo "tag_name=$(git describe HEAD --abbrev=0)" >> $GITHUB_OUTPUT | |
- name: Create Github release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.publish_tag.outputs.tag_name }} | |
bodyFile: RELEASE_BODY.md | |
# NOTE: We always generate pre-releases and mark them as releases manually | |
prerelease: true | |
publish-olm-candidate: | |
needs: | |
- create-github-prerelease | |
runs-on: ubuntu-latest | |
environment: quay | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.REPOSITORY_PUSH_TOKEN }} | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Set version | |
id: version | |
run: | | |
version="$(cat VERSION)-rc" | |
echo "version=$version" >> "$GITHUB_OUTPUT" | |
- name: publish catalog | |
uses: ./.github/olm-publish | |
env: | |
IMAGE_BASE: ${{ secrets.IMAGE_BASE }} | |
VERSION: ${{ steps.version.outputs.version }} | |
CHANNELS: candidate,development | |
DEFAULT_CHANNEL: candidate | |
RELEASE_SHA: ${GITHUB_SHA} | |
with: | |
quay_login: ${{ secrets.QUAY_LOGIN }} | |
quay_token: ${{ secrets.QUAY_TOKEN }} | |
- name: Push catalog index changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.REPOSITORY_PUSH_TOKEN }} | |
branch: olm-catalog | |
- name: Publish Package | |
uses: ./.github/package-operator-publish | |
env: | |
IMAGE_BASE: ${{ secrets.IMAGE_BASE }} | |
VERSION: ${{ steps.version.outputs.version }} | |
with: | |
quay_login: ${{ secrets.QUAY_LOGIN }} | |
quay_token: ${{ secrets.QUAY_TOKEN }} | |
- name: Publish test harness | |
uses: ./.github/osd-test-harness-publish | |
env: | |
IMAGE_BASE: ${{ secrets.IMAGE_BASE }} | |
VERSION: ${{ steps.version.outputs.version }} | |
with: | |
quay_login: ${{ secrets.QUAY_LOGIN }} | |
quay_token: ${{ secrets.QUAY_TOKEN }} |