-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (71 loc) · 2.18 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: publish
on:
push:
tags:
- 'v*.*.*'
jobs:
assets:
permissions:
contents: write
packages: write
pull-requests: read
strategy:
matrix:
target_os: ["linux", "darwin", "windows"]
target_arch: ["amd64", "arm64"]
runs-on: ubuntu-latest
env:
EARTHLY_MAX_REMOTE_CACHE: true
REMOTE_CACHE: "ghcr.io/${{ github.repository_owner }}/earthly-cache"
EARTHLY_PUSH: true
EARTHLY_CI: true
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
- name: Earthly
uses: earthly/actions-setup@v1
- name: +build ${{ matrix.target_os }}/${{ matrix.target_arch }}
run: |
export EARTHLY_REMOTE_CACHE="${{ env.REMOTE_CACHE }}:$(basename ${{ github.repository }})"
earthly -a +build/release --TARGET_OS=${{ matrix.target_os }} --TARGET_ARCH=${{ matrix.target_arch }} ./
- name: Upload assets
uses: softprops/action-gh-release@v1
with:
files: ./release/*
docker:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true