Skip to content

Commit

Permalink
fix: add build workflow (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts authored Dec 20, 2023
1 parent b9cc9c2 commit 112232c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 43 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build

on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: actions/setup-go@v5
with:
go-version: 1.21
- id: meta
name: Docker meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/manaelproxy/manael
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- if: ${{ github.event_name == 'release' }}
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- env:
CGO_CFLAGS: -I/tmp/libwebp/include -I/tmp/libaom/include
CGO_LDFLAGS: -L/tmp/libwebp/lib -lwebp -L/tmp/libaom/lib -laom -lm
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name == 'release' }}
46 changes: 3 additions & 43 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,15 @@ jobs:
release-please:
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
contents: write
pull-requests: write

steps:
- id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.RELEASE_PLEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_PLEASE_PRIVATE_KEY }}
- id: release
uses: google-github-actions/release-please-action@v4
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Checkout
uses: actions/checkout@v4
- if: ${{ steps.release.outputs.release_created }}
name: Set up QEMU
uses: actions/setup-go@v5
with:
go-version: 1.21
- id: meta
name: Docker meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/manaelproxy/manael
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- if: ${{ steps.release.outputs.release_created }}
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- env:
CGO_CFLAGS: -I/tmp/libwebp/include -I/tmp/libaom/include
CGO_LDFLAGS: -L/tmp/libwebp/lib -lwebp -L/tmp/libaom/lib -laom -lm
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: ${{ steps.release.outputs.release_created || false }}

0 comments on commit 112232c

Please sign in to comment.