-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3.04 KB
/
release.yml
File metadata and controls
98 lines (86 loc) · 3.04 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release
on:
push:
branches: ["main"]
schedule:
- cron: "0 0 * * MON"
workflow_dispatch:
jobs:
build-elm-individual:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
strategy:
matrix:
platform: [linux/amd64, linux/arm64/v8]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Packages
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
username: ${{ secrets.GH_PACKAGES_USERNAME }}
password: ${{ secrets.GH_PACKAGES_PASSWORD }}
registry: ghcr.io
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Calculate version
run: |
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
ARCH_TAG=$(echo ${{ matrix.platform }} | sed 's|/|-|g')
NEW_TAG="$ARCH_TAG-v$YEAR.$MONTH.$DAY"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
echo "PACKAGE_TAG=ghcr.io/yertools/elm-binary:$NEW_TAG" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/elm-build.dockerfile
push: true
tags: ${{ env.PACKAGE_TAG }}
builder: ${{ steps.buildx.outputs.name }}
platforms: ${{ matrix.platform }}
build-elm-multi-platform:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: build-elm-individual
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Packages
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
username: ${{ secrets.GH_PACKAGES_USERNAME }}
password: ${{ secrets.GH_PACKAGES_PASSWORD }}
registry: ghcr.io
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Calculate version
run: |
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
NEW_TAG="v$YEAR.$MONTH.$DAY"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
echo "LATEST_TAG=ghcr.io/yertools/elm-binary:latest" >> $GITHUB_ENV
echo "PACKAGE_TAG=ghcr.io/yertools/elm-binary:$NEW_TAG" >> $GITHUB_ENV
- name: Copy binaries
run: |
docker create --name temp-amd64 ghcr.io/yertools/elm-binary:linux-amd64-$NEW_TAG
docker cp temp-amd64:/elm ./elm-amd64
docker rm temp-amd64
docker create --name temp-arm64 ghcr.io/yertools/elm-binary:linux-arm64-v8-v$NEW_TAG
docker cp temp-arm64:/elm ./elm-arm64
docker rm temp-arm64
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/elm-build-multi-platform.dockerfile
push: true
tags: ${{ env.PACKAGE_TAG }},${{ env.LATEST_TAG }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64/v8