Skip to content

Commit

Permalink
ci: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdk committed Feb 8, 2024
1 parent 613b237 commit 05b2f48
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -35,7 +35,7 @@ jobs:
echo "revision=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v3
- uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
tags: |
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release
on:
push:
tags:
- "v*.*.*"

jobs:
release:
name: Release
runs-on: ubuntu-22.04

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3
id: buildx

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: output docker build args
id: args
run: |
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "revision=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
- name: output semver tags
id: tags
run: |
echo "major=$(echo ${{ github.ref_name }} | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "minor=$(echo ${{ github.ref_name }} | cut -d. -f1,2)" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
tags: |
ghcr.io/joshdk/actions-docker-shim:latest
ghcr.io/joshdk/actions-docker-shim:${{ github.ref_name }}
ghcr.io/joshdk/actions-docker-shim:${{ steps.tags.outputs.minor }}
ghcr.io/joshdk/actions-docker-shim:${{ steps.tags.outputs.major }}
push: true
build-args: |
CREATED=${{ steps.args.outputs.created }}
REVISION=${{ steps.args.outputs.revision }}
VERSION=${{ steps.args.outputs.version }}

0 comments on commit 05b2f48

Please sign in to comment.