Skip to content

Commit

Permalink
Add push to ghcr for unstable branch
Browse files Browse the repository at this point in the history
  • Loading branch information
NHAS committed Nov 25, 2024
1 parent ddaace3 commit ecc5fde
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: ["push"]
jobs:
test:
runs-on: ubuntu-latest

if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/unstable'
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Test with the Go CLI
run: go test -exec sudo -v ./...

deploy:
deploy-dockerhub:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -67,3 +67,50 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: wagvpn/wag:latest
push: true

deploy-ghcr:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/unstable'
strategy:
fail-fast: true
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

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

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=unstable,enable=${{ github.ref == 'refs/heads/unstable' }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

0 comments on commit ecc5fde

Please sign in to comment.