-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
553c7c1
commit e61e6bf
Showing
2 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
required: true | ||
description: The version to release | ||
|
||
permissions: | ||
packages: write | ||
contents: write | ||
|
||
jobs: | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Generate metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/crftd-tech/trunkver | ||
tags: | | ||
type=raw,value=${{ github.event.inputs.version }} | ||
type=raw,value=latest | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99 | ||
with: | ||
registry: "ghcr.io" | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@31ca4e5d51253d7e4a2317bfe74699cbe3a398a9 | ||
with: | ||
context: . | ||
build-args: | | ||
VERSION=${{ github.event.inputs.version }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Update the action.yml with the new image tag | ||
run: | | ||
yq eval --inplace '.runs.image = "docker://ghcr.io/crftd-tech/trunkver:${{ github.event.inputs.version }}"' action.yml | ||
git config --global user.email "bot@crftd.tech" | ||
git config --global user.name "crftd-bot" | ||
git add action.yml | ||
git commit -m "chore: Bump image tag in action.yml" | ||
git pull origin --rebase | ||
git push origin | ||
build-release: | ||
runs-on: ubuntu-latest | ||
needs: [build-docker] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: Build trunkver | ||
env: | ||
VERSION: ${{ github.event.inputs.version }} | ||
run: | | ||
( | ||
unset GITHUB_SHA | ||
unset GITHUB_RUN_ID | ||
make test all spec "VERSION=${VERSION}" | ||
) | ||
- name: Create release | ||
id: release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: ${{ github.event.inputs.version }} | ||
tag_name: ${{ github.event.inputs.version }} | ||
files: | | ||
out/trunkver* |