Skip to content

Commit

Permalink
feat(ci): add release job
Browse files Browse the repository at this point in the history
Signed-off-by: iverly <[email protected]>
  • Loading branch information
iverly committed Nov 27, 2023
1 parent 33cea54 commit aa25789
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: release

on:
push:
tags:
- 'v*'

env:
CARGO_TERM_COLOR: always

permissions:
contents: write

jobs:
docker:
name: docker-${{ matrix.app }}
strategy:
fail-fast: false
matrix:
app: ['api', 'www']
runs-on: ubuntu-latest
steps:
- 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: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/$GITHUB_REPOSITORY
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: .
file: ./apps/${{ matrix.app }}/Dockerfile
platforms: linux/amd64, linux/arm64, linux/arm/v7
create-github-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get tag name
id: tag
run: echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/}

- name: Create GitHub Release
uses: taiki-e/create-gh-release-action@v1
with:
title: Release ${{ steps.tag.outputs.tag_name }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit aa25789

Please sign in to comment.