Skip to content

Commit

Permalink
update release workflows (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
glitchcrab authored Feb 15, 2024
1 parent 685a3ae commit 292be7f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 38 deletions.
68 changes: 37 additions & 31 deletions .github/workflows/zz_generated.create_release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.24.0
# devctl@6.20.2
#
name: Create Release
on:
Expand All @@ -15,7 +15,7 @@ on:
jobs:
debug_info:
name: Debug info
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Print github context JSON
run: |
Expand All @@ -24,19 +24,18 @@ jobs:
EOF
gather_facts:
name: Gather facts
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
project_go_path: ${{ steps.get_project_go_path.outputs.path }}
ref_version: ${{ steps.ref_version.outputs.refversion }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version
id: get_version
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
title="$(cat <<- 'COMMIT_MESSAGE_END' | head -n 1 -
${{ github.event.head_commit.message }}
COMMIT_MESSAGE_END
)"
title=$(echo -n "${COMMIT_MESSAGE}" | head -1)
# Matches strings like:
#
# - "Release v1.2.3"
Expand All @@ -53,7 +52,7 @@ jobs:
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Checkout code
if: ${{ steps.get_version.outputs.version != '' }}
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get project.go path
id: get_project_go_path
if: ${{ steps.get_version.outputs.version != '' }}
Expand All @@ -66,11 +65,10 @@ jobs:
echo "path=${path}" >> $GITHUB_OUTPUT
- name: Check if reference version
id: ref_version
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
title="$(cat <<- 'COMMIT_MESSAGE_END' | head -n 1 -
${{ github.event.head_commit.message }}
COMMIT_MESSAGE_END
)"
title=$(echo -n "${COMMIT_MESSAGE}" | head -1)
if echo "${title}" | grep -qE '^release v[0-9]+\.[0-9]+\.[0-9]+([.-][^ .-][^ ]*)?( \(#[0-9]+\))?$' ; then
version=$(echo "${title}" | cut -d ' ' -f 2)
fi
Expand All @@ -84,26 +82,26 @@ jobs:
echo "refversion=${refversion}" >> $GITHUB_OUTPUT
update_project_go:
name: Update project.go
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: ${{ needs.gather_facts.outputs.version != '' && needs.gather_facts.outputs.project_go_path != '' && needs.gather_facts.outputs.ref_version != 'true' }}
needs:
- gather_facts
steps:
- name: Install architect
uses: giantswarm/install-binary-action@v1.1.0
uses: giantswarm/install-binary-action@v2.0.0
with:
binary: "architect"
version: "6.11.0"
version: "6.14.1"
- name: Install semver
uses: giantswarm/install-binary-action@v1.1.0
uses: giantswarm/install-binary-action@v2.0.0
with:
binary: "semver"
version: "3.2.0"
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz"
tarball_binary_path: "*/src/${binary}"
smoke_test: "${binary} --version"
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Update project.go
id: update_project_go
env:
Expand Down Expand Up @@ -143,18 +141,27 @@ jobs:
version: "${{ needs.gather_facts.outputs.version }}"
title: "Bump version to ${{ steps.update_project_go.outputs.new_version }}"
run: |
hub pull-request -f -m "${{ env.title }}" -b ${{ env.base }} -h ${{ env.branch }} -r ${{ github.actor }}
gh pr create --title "${{ env.title }}" --body "" --base ${{ env.base }} --head ${{ env.branch }} --reviewer ${{ github.actor }}
- name: Enable auto-merge for PR
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
base: "${{ github.ref }}"
branch: "${{ github.ref }}-version-bump"
version: "${{ needs.gather_facts.outputs.version }}"
title: "Bump version to ${{ steps.update_project_go.outputs.new_version }}"
run: |
gh pr merge --auto --squash "${{ env.branch }}" || echo "::warning::Auto-merge not allowed. Please adjust the repository settings."
create_release:
name: Create release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.version }}
outputs:
upload_url: ${{ steps.create_gh_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Ensure correct version in project.go
Expand Down Expand Up @@ -184,31 +191,30 @@ jobs:
git push "${REMOTE_REPO}" --tags
- name: Create release
id: create_gh_release
uses: actions/create-release@v1
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
with:
body: ${{ steps.changelog_reader.outputs.changes }}
tag_name: "v${{ needs.gather_facts.outputs.version }}"
release_name: "v${{ needs.gather_facts.outputs.version }}"
tag: "v${{ needs.gather_facts.outputs.version }}"

create-release-branch:
name: Create release branch
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.version }}
steps:
- name: Install semver
uses: giantswarm/install-binary-action@v1.1.0
uses: giantswarm/install-binary-action@v2.0.0
with:
binary: "semver"
version: "3.0.0"
download_url: "https://github.com/fsaintjacques/${binary}-tool/archive/${version}.tar.gz"
tarball_binary_path: "*/src/${binary}"
smoke_test: "${binary} --version"
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # Clone the whole history, not just the most recent commit.
- name: Fetch all tags and branches
Expand Down Expand Up @@ -254,7 +260,7 @@ jobs:
create_and_upload_build_artifacts:
name: Create and upload build artifacts
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -266,7 +272,7 @@ jobs:
- windows-amd64
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
GO_VERSION: 1.19.6
GO_VERSION: 1.21.3
ARTIFACT_DIR: bin-dist
TAG: v${{ needs.gather_facts.outputs.version }}
CODE_SIGNING_CERT_BUNDLE_BASE64: ${{ secrets.CODE_SIGNING_CERT_BUNDLE_BASE64 }}
Expand All @@ -276,16 +282,16 @@ jobs:
- gather_facts
steps:
- name: Install architect
uses: giantswarm/install-binary-action@v1.1.0
uses: giantswarm/install-binary-action@v2.0.0
with:
binary: "architect"
version: "6.11.0"
version: "6.14.1"
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3.3.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ env.TAG }}
- name: Create ${{ matrix.platform }} package
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/zz_generated.create_release_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.24.0
# devctl@6.20.2
#
name: Create Release PR
on:
Expand Down Expand Up @@ -30,7 +30,7 @@ on:
jobs:
debug_info:
name: Debug info
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Print github context JSON
run: |
Expand All @@ -39,7 +39,7 @@ jobs:
EOF
gather_facts:
name: Gather facts
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
repo_name: ${{ steps.gather_facts.outputs.repo_name }}
branch: ${{ steps.gather_facts.outputs.branch }}
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
fi
create_release_pr:
name: Create release PR
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- gather_facts
if: ${{ needs.gather_facts.outputs.skip != 'true' }}
Expand All @@ -147,12 +147,12 @@ jobs:
with:
go-version: '=1.18.1'
- name: Install architect
uses: giantswarm/install-binary-action@v1.1.0
uses: giantswarm/install-binary-action@v2.0.0
with:
binary: "architect"
version: "6.11.0"
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ needs.gather_facts.outputs.branch }}
- name: Prepare release changes
Expand Down Expand Up @@ -227,4 +227,4 @@ jobs:
base: "${{ needs.gather_facts.outputs.base }}"
version: "${{ needs.gather_facts.outputs.version }}"
run: |
hub pull-request -f -m "Release v${{ env.version }}" -a ${{ github.actor }} -b ${{ env.base }} -h ${{ needs.gather_facts.outputs.branch }}
gh pr create --assignee ${{ github.actor }} --title "Release v${{ env.version }}" --body "" --base ${{ env.base }} --head "${{ needs.gather_facts.outputs.branch }}"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add flags to configure group ID, running as non-root and allowing privilege escalation.

### Changed

- Update release workflows.

## [0.8.1] - 2023-05-05

### Changed
Expand Down

0 comments on commit 292be7f

Please sign in to comment.