FakeRelay/.github/workflows/build.yml

72 lines
2.6 KiB
YAML
Raw Normal View History

2022-12-03 21:27:52 +01:00
name: build
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
2022-12-18 15:18:09 +01:00
strategy:
matrix:
architecture: [ amd64, arm64v8 ]
2022-12-03 21:27:52 +01:00
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # get entire git tree, required for nerdbank gitversioning
2022-12-03 21:39:05 +01:00
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the Docker image
2022-12-03 21:27:52 +01:00
shell: pwsh
run: |
2022-12-03 21:39:05 +01:00
Push-Location src
2022-12-03 21:27:52 +01:00
$version = (nbgv get-version -f json | ConvertFrom-Json).SimpleVersion
Write-Host "Version $version"
2022-12-03 21:39:05 +01:00
Pop-Location
2022-12-18 15:18:09 +01:00
if ('${{ matrix.architecture }}' -eq 'arm64v8') {
sudo apt-get install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
}
docker build . -t ghcr.io/g3rv4/fakerelay:latest-${{ matrix.architecture }} --build-arg ARCH=${{ matrix.architecture }}
docker tag ghcr.io/g3rv4/fakerelay:latest-${{ matrix.architecture }} ghcr.io/g3rv4/fakerelay:$version-${{ matrix.architecture }}
docker push ghcr.io/g3rv4/fakerelay:latest-${{ matrix.architecture }}
docker push ghcr.io/g3rv4/fakerelay:$version-${{ matrix.architecture }}
2023-07-15 23:17:39 +02:00
push-manifest:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # get entire git tree, required for nerdbank gitversioning
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build manifest
shell: pwsh
run: |
Push-Location src
$version = (nbgv get-version -f json | ConvertFrom-Json).SimpleVersion
Write-Host "Version $version"
Pop-Location
2022-12-18 15:18:09 +01:00
2023-07-15 23:17:39 +02:00
docker manifest create `
ghcr.io/g3rv4/fakerelay:latest `
--amend ghcr.io/g3rv4/fakerelay:latest-amd64 `
--amend ghcr.io/g3rv4/fakerelay:latest-arm64v8
docker manifest create `
ghcr.io/g3rv4/fakerelay:$version `
--amend ghcr.io/g3rv4/fakerelay:$version-amd64 `
--amend ghcr.io/g3rv4/fakerelay:$version-arm64v8
docker manifest push ghcr.io/g3rv4/fakerelay:latest
docker manifest push ghcr.io/g3rv4/fakerelay:$version