CI: Travis -> GitHub Actions; Create Release Binaries and Container Images #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
# Run on push to main and any pull request. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: | |
- pebble | |
- pebble-challtestsrv | |
go-arch: | |
- amd64 | |
- arm64 | |
go-os: | |
- darwin | |
- linux | |
- windows | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version-file: go.mod | |
- name: Build ${{ matrix.app }} | |
env: | |
APP: ${{ matrix.app }} | |
GOARCH: ${{ matrix.go-arch }} | |
GOOS: ${{ matrix.go-os }} | |
run: ./build-release.sh | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.go-os }}-${{ matrix.go-arch }} | |
path: dist | |
docker: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: | |
- pebble | |
- pebble-challtestsrv | |
docker-arch: | |
- amd64 | |
- arm64 | |
docker-os: | |
- linux | |
- windows | |
exclude: | |
- docker-arch: arm64 | |
docker-os: windows | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: dist-${{ matrix.docker-os }}-${{ matrix.docker-arch }} | |
- name: Display artifacts | |
run: ls -lR dist | |
- 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: Build and push ${{ github.repository }}/${{ matrix.app }} for ${{ matrix.docker-os }}/${{ matrix.docker-arch }} | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: APP=${{ matrix.app }} | |
build-contexts: dist-files=dist | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
file: Dockerfile.release | |
platforms: ${{ matrix.docker-os }}/${{ matrix.docker-arch }} | |
push: true | |
tags: ghcr.io/${{ github.repository }}/${{ matrix.app }}:${{ github.sha }} |