Skip to content

Commit

Permalink
fix: Fix release job
Browse files Browse the repository at this point in the history
  • Loading branch information
kianaza committed May 29, 2024
1 parent 8c34f10 commit 2b56c35
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 14 deletions.
76 changes: 62 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,65 @@ jobs:
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
slug: snapp-incubator/nats-blackbox-exporter
gorelease:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.22"
- uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-push:
name: Build & Push
runs-on: ubuntu-latest
needs:
- lint
# - test
strategy:
matrix:
command: [janus, ion-sfu]
env:
REGISTRY: ghcr.io
USERNAME: ${{ github.repository_owner }}
REPOSITORY: ${{ github.event.repository.name }}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.22.x

- name: Checks out our project source code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v3
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.REPOSITORY }}-${{ matrix.command }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Generate Dockerfile
run: |
render() {
sedStr="s!%%COMMAND%%!$command!g;"
sed -r "$sedStr" $1
}
command=${{ matrix.command }}
render build/template.Dockerfile > build/$command.Dockerfile
- uses: docker/build-push-action@v2
with:
file: "build/${{ matrix.command }}.Dockerfile"
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: release
on:
push:
tags:
- '*'
jobs:
gorelease:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.22"
- uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 2b56c35

Please sign in to comment.