-
Notifications
You must be signed in to change notification settings - Fork 9
56 lines (47 loc) · 1.52 KB
/
tag.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
name: Earthly tag +build
on:
push:
tags:
- "v*.*.*"
env:
FORCE_COLOR: 1
jobs:
tag:
permissions:
packages: write
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
# Setup repo and add caching
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GIT_REPO_TOKEN }}
# There is a bug selecting a satellite in version 0.8
# so we use 0.7 to login and connect to the satellite
# before switching to the latest version
- uses: earthly/actions-setup@v1
with:
version: v0.8.3
- name: Earthly login
run: |
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
earthly org s blue-build
earthly sat s blue-build-tag
- name: Set up Python
uses: actions/setup-python@v5
- name: Add tomlq
run: pip install tomlq
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run build
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
CARGO_PACKAGE_VERSION="v$(tomlq '.package.version' $PWD/Cargo.toml | sed 's/\"//g')"
LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false)
earthly --push --ci -P +all --TAG=$LATEST_TAG --LATEST=$LATEST