diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..0898a5f --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 }}