go.mod, actions: use mkctr to build multi-arch builds #137
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: "Nix build" | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v18 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Basic CLI and web build" | |
run: | | |
nix build .#tclip .#tclipd | |
- name: "Docker image build" | |
run: | | |
nix build .#docker_amd64 | |
docker load < ./result | |
nix build .#docker_arm64 | |
docker load < ./result | |
- name: "docker login" | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
if: "github.event_name == 'push' && github.ref_name == 'main'" | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Docker image push" | |
if: "github.event_name == 'push' && github.ref_name == 'main'" | |
run: | | |
docker push ghcr.io/tailscale-dev/tclip:arm64 | |
docker push ghcr.io/tailscale-dev/tclip:amd64 | |
docker manifest create ghcr.io/tailscale-dev/tclip:latest ghcr.io/tailscale-dev/tclip:arm64 ghcr.io/tailscale-dev/tclip:amd64 | |
docker manifest push ghcr.io/tailscale-dev/tclip:latest | |
- name: "Portable service build" | |
run: | | |
nix build .#portable-service | |
mkdir -p var | |
cp ./result/*.raw ./var | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: portable-service | |
path: ./var/*.raw | |