-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (40 loc) · 1.48 KB
/
release.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
# .github/workflows/release.yml
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: nelonoel/[email protected]
- name: Docker Login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
- name: Download latest earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.5.11/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Earthly Version
run: earthly --version
- name: Create Version
id: version
run: |
# TODO: find a better way to version from tags
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# set to output var
echo ::set-output name=VERSION::${VERSION}
- name: Build
env:
EARTHLY_BUILD_ARGS: "BRANCH_NAME,COMMIT_HASH,VERSION"
FORCE_COLOR: 1
COMMIT_HASH: ${{ github.sha }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: earthly -P --ci --push +release