Skip to content

Commit

Permalink
Ci/release and tagging (#78)
Browse files Browse the repository at this point in the history
* ci: handle tag event

* ci: add release workflow
  • Loading branch information
spoukke authored Feb 24, 2023
1 parent 81049d7 commit 9fafd91
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
25 changes: 8 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
Expand All @@ -29,31 +31,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get version from main branch
if: ${{ github.event_name == 'push' }}
run: |
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
- name: Get version from pull request
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "VERSION=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV

- name: Get Build timestamp
- name: Get Build timestamp and branch name
run: |
echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV
echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v3
Expand All @@ -62,7 +53,7 @@ jobs:
build-args: |
VERSION=${{ env.VERSION }}
BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }}
COMMIT_HASH=${{ env.VERSION }}
COMMIT_HASH=${{ github.sha }}
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
ghcr.io/${{ github.repository }}:${{ github.sha }}
14 changes: 14 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: go

0 comments on commit 9fafd91

Please sign in to comment.