Enable CI in PRs (#36)
Co-authored-by: Jordan Potter <me@jordanpotter.com>
This commit is contained in:
parent
151215a763
commit
eefe2e4c9a
1 changed files with 22 additions and 9 deletions
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
|
@ -2,16 +2,17 @@ name: Continuous Integration
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * TUE"
|
- cron: "0 0 * * TUE"
|
||||||
|
|
||||||
concurrency: ${{ github.workflow }}
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
platforms: "linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
ci:
|
||||||
name: Publish
|
name: Continuous Integration
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -31,7 +32,7 @@ jobs:
|
||||||
run: sudo apt-get install wireguard
|
run: sudo apt-get install wireguard
|
||||||
|
|
||||||
- name: Download WireGuard config
|
- name: Download WireGuard config
|
||||||
run: echo "${{ secrets.WIREGUARD_CONF }}" > wireguard.conf
|
run: echo '${{ secrets.WIREGUARD_CONF }}' > wireguard.conf
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
@ -100,19 +101,31 @@ jobs:
|
||||||
jordanpotter/wireguard
|
jordanpotter/wireguard
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=${{ steps.date.outputs.formattedTime }}
|
type=raw,value=${{ steps.date.outputs.formattedTime }},enable=${{ github.event_name == 'schedule' }}
|
||||||
type=raw,value=latest,enable={{ is_default_branch }}
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
|
|
||||||
|
- name: Build images
|
||||||
|
if: ${{ github.ref != 'refs/heads/main' }}
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
pull: true
|
||||||
|
push: false
|
||||||
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
|
platforms: ${{ env.platforms }}
|
||||||
|
|
||||||
- name: Build and push images
|
- name: Build and push images
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.metadata.outputs.tags }}
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
labels: ${{ steps.metadata.outputs.labels }}
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
platforms: ${{ env.platforms }}
|
||||||
|
|
||||||
- name: Update Docker Hub description
|
- name: Update Docker Hub description
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
uses: peter-evans/dockerhub-description@v3
|
uses: peter-evans/dockerhub-description@v3
|
||||||
with:
|
with:
|
||||||
repository: jordanpotter/wireguard
|
repository: jordanpotter/wireguard
|
||||||
|
|
Loading…
Reference in a new issue