|
@ -10,23 +10,29 @@ on: |
|
|
# as this will break the latest and major tags |
|
|
# as this will break the latest and major tags |
|
|
|
|
|
|
|
|
jobs: |
|
|
jobs: |
|
|
docker: |
|
|
docker-build: |
|
|
name: Build & Deploy Docker |
|
|
name: Build Docker |
|
|
runs-on: ubuntu-latest |
|
|
runs-on: ${{ matrix.arch.os }} |
|
|
if: | |
|
|
if: | |
|
|
github.repository_owner == 'wg-easy' && |
|
|
github.repository_owner == 'wg-easy' && |
|
|
startsWith(github.ref, 'refs/tags/v') |
|
|
startsWith(github.ref, 'refs/tags/v') |
|
|
permissions: |
|
|
permissions: |
|
|
packages: write |
|
|
packages: write |
|
|
contents: read |
|
|
strategy: |
|
|
|
|
|
fail-fast: false |
|
|
|
|
|
matrix: |
|
|
|
|
|
arch: |
|
|
|
|
|
- platform: linux/amd64 |
|
|
|
|
|
os: ubuntu-latest |
|
|
|
|
|
- platform: linux/arm64 |
|
|
|
|
|
os: ubuntu-24.04-arm |
|
|
steps: |
|
|
steps: |
|
|
- uses: actions/checkout@v4 |
|
|
- uses: actions/checkout@v4 |
|
|
|
|
|
|
|
|
- name: Set up QEMU |
|
|
- name: Prepare |
|
|
uses: docker/setup-qemu-action@v3 |
|
|
run: | |
|
|
|
|
|
platform=${{ matrix.arch.platform }} |
|
|
- name: Set up Docker Buildx |
|
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV |
|
|
uses: docker/setup-buildx-action@v3 |
|
|
|
|
|
|
|
|
|
|
|
- name: Docker meta |
|
|
- name: Docker meta |
|
|
id: meta |
|
|
id: meta |
|
@ -36,10 +42,6 @@ jobs: |
|
|
ghcr.io/wg-easy/wg-easy |
|
|
ghcr.io/wg-easy/wg-easy |
|
|
flavor: | |
|
|
flavor: | |
|
|
latest=false |
|
|
latest=false |
|
|
tags: | |
|
|
|
|
|
type=semver,pattern={{version}} |
|
|
|
|
|
type=semver,pattern={{major}} |
|
|
|
|
|
type=semver,pattern={{major}}.{{minor}} |
|
|
|
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry |
|
|
- name: Login to GitHub Container Registry |
|
|
uses: docker/login-action@v3 |
|
|
uses: docker/login-action@v3 |
|
@ -48,16 +50,87 @@ jobs: |
|
|
username: ${{ github.actor }} |
|
|
username: ${{ github.actor }} |
|
|
password: ${{ secrets.GITHUB_TOKEN }} |
|
|
password: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
|
|
|
|
|
- name: Build & Publish Docker Image |
|
|
- name: Set up QEMU |
|
|
|
|
|
uses: docker/setup-qemu-action@v3 |
|
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx |
|
|
|
|
|
uses: docker/setup-buildx-action@v3 |
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push by digest |
|
|
|
|
|
id: build |
|
|
uses: docker/build-push-action@v6 |
|
|
uses: docker/build-push-action@v6 |
|
|
with: |
|
|
with: |
|
|
context: . |
|
|
context: . |
|
|
push: true |
|
|
platforms: ${{ matrix.arch.platform }} |
|
|
platforms: linux/amd64,linux/arm64 |
|
|
|
|
|
tags: ${{ steps.meta.outputs.tags }} |
|
|
|
|
|
labels: ${{ steps.meta.outputs.labels }} |
|
|
labels: ${{ steps.meta.outputs.labels }} |
|
|
cache-from: type=gha |
|
|
tags: ghcr.io/wg-easy/wg-easy |
|
|
cache-to: type=gha,mode=min |
|
|
outputs: type=image,push-by-digest=true,name-canonical=true,push=true |
|
|
|
|
|
cache-from: type=gha,scope=build-${{ env.PLATFORM_PAIR }} |
|
|
|
|
|
cache-to: type=gha,mode=min,scope=build-${{ env.PLATFORM_PAIR }} |
|
|
|
|
|
|
|
|
|
|
|
- name: Export digest |
|
|
|
|
|
run: | |
|
|
|
|
|
mkdir -p ${{ runner.temp }}/digests |
|
|
|
|
|
digest="${{ steps.build.outputs.digest }}" |
|
|
|
|
|
touch "${{ runner.temp }}/digests/${digest#sha256:}" |
|
|
|
|
|
|
|
|
|
|
|
- name: Upload digest |
|
|
|
|
|
uses: actions/upload-artifact@v4 |
|
|
|
|
|
with: |
|
|
|
|
|
name: digests-${{ env.PLATFORM_PAIR }} |
|
|
|
|
|
path: ${{ runner.temp }}/digests/* |
|
|
|
|
|
if-no-files-found: error |
|
|
|
|
|
retention-days: 1 |
|
|
|
|
|
|
|
|
|
|
|
docker-merge: |
|
|
|
|
|
name: Merge & Deploy Docker |
|
|
|
|
|
runs-on: ubuntu-latest |
|
|
|
|
|
if: | |
|
|
|
|
|
github.repository_owner == 'wg-easy' && |
|
|
|
|
|
startsWith(github.ref, 'refs/tags/v') |
|
|
|
|
|
permissions: |
|
|
|
|
|
packages: write |
|
|
|
|
|
needs: docker-build |
|
|
|
|
|
steps: |
|
|
|
|
|
- name: Download digests |
|
|
|
|
|
uses: actions/download-artifact@v4 |
|
|
|
|
|
with: |
|
|
|
|
|
path: ${{ runner.temp }}/digests |
|
|
|
|
|
pattern: digests-* |
|
|
|
|
|
merge-multiple: true |
|
|
|
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry |
|
|
|
|
|
uses: docker/login-action@v3 |
|
|
|
|
|
with: |
|
|
|
|
|
registry: ghcr.io |
|
|
|
|
|
username: ${{ github.actor }} |
|
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx |
|
|
|
|
|
uses: docker/setup-buildx-action@v3 |
|
|
|
|
|
|
|
|
|
|
|
- name: Docker meta |
|
|
|
|
|
id: meta |
|
|
|
|
|
uses: docker/metadata-action@v5 |
|
|
|
|
|
with: |
|
|
|
|
|
images: | |
|
|
|
|
|
ghcr.io/wg-easy/wg-easy |
|
|
|
|
|
flavor: | |
|
|
|
|
|
latest=false |
|
|
|
|
|
tags: | |
|
|
|
|
|
type=semver,pattern={{version}} |
|
|
|
|
|
type=semver,pattern={{major}} |
|
|
|
|
|
type=semver,pattern={{major}}.{{minor}} |
|
|
|
|
|
|
|
|
|
|
|
- name: Create manifest list and push |
|
|
|
|
|
working-directory: ${{ runner.temp }}/digests |
|
|
|
|
|
run: | |
|
|
|
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
|
|
|
|
|
$(printf 'ghcr.io/wg-easy/wg-easy@sha256:%s ' *) |
|
|
|
|
|
|
|
|
|
|
|
- name: Inspect image |
|
|
|
|
|
run: | |
|
|
|
|
|
docker buildx imagetools inspect ghcr.io/wg-easy/wg-easy:${{ steps.meta.outputs.version }} |
|
|
|
|
|
|
|
|
docs: |
|
|
docs: |
|
|
name: Build & Deploy Docs |
|
|
name: Build & Deploy Docs |
|
@ -67,7 +140,7 @@ jobs: |
|
|
startsWith(github.ref, 'refs/tags/v') |
|
|
startsWith(github.ref, 'refs/tags/v') |
|
|
permissions: |
|
|
permissions: |
|
|
contents: write |
|
|
contents: write |
|
|
needs: docker |
|
|
needs: docker-merge |
|
|
steps: |
|
|
steps: |
|
|
- uses: actions/checkout@v4 |
|
|
- uses: actions/checkout@v4 |
|
|
|
|
|
|
|
@ -93,8 +166,8 @@ jobs: |
|
|
git fetch origin gh-pages --depth=1 || true |
|
|
git fetch origin gh-pages --depth=1 || true |
|
|
|
|
|
|
|
|
# Extract version numbers |
|
|
# Extract version numbers |
|
|
DOCS_VERSION=${GITHUB_REF#refs/tags/} # e.g. v1.2.3 or v1.2.3-beta |
|
|
DOCS_VERSION=${GITHUB_REF#refs/tags/} # e.g. v1.2.3 or v1.2.3-beta |
|
|
MINOR_VERSION=$(echo $DOCS_VERSION | cut -d. -f1,2) # e.g. v1.2 |
|
|
MINOR_VERSION=$(echo $DOCS_VERSION | cut -d. -f1,2) # e.g. v1.2 |
|
|
|
|
|
|
|
|
# Check if it's a stable release (only numbers, no '-') |
|
|
# Check if it's a stable release (only numbers, no '-') |
|
|
if [[ "$DOCS_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
|
|
if [[ "$DOCS_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
|
|