-
Notifications
You must be signed in to change notification settings - Fork 15
95 lines (95 loc) · 3.72 KB
/
build.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build everything
on:
- push
env:
REGISTRY: ghcr.io
defaults:
run:
shell: bash
# specifying `bash` here ensures `set -eo pipefail` is active
jobs:
build-everything:
runs-on: ubuntu-latest
permissions:
# contents:write allows creating a GitHub Release.
# packages:write allows publishing an image to GitHub Packages.
contents: write
packages: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
# autotag requires a reasonably complete git history.
fetch-depth: 0
- name: Build fusedav-dev image
run: docker build --progress plain --target dev -t fusedav-dev .
- name: Install autotag
run: |
curl -fsSL https://github.com/pantheon-systems/autotag/releases/latest/download/autotag_linux_amd64 \
-o /usr/local/bin/autotag
chmod 0755 /usr/local/bin/autotag
- name: Generate new version strings and tag(s)
env:
IMAGE_NAME: ${{ github.repository }}
run: |
echo "new-version.sh:"
scripts/compute-version.sh | tee new-version.sh
- name: Build/tag fusedav image
run: |
echo START build target extract
docker build --progress plain --target extract . --output extract
echo DONE build target extract
echo
echo START build final image
. new-version.sh
# Use older "maintainer" label instead of "org.opencontainers.image.maintainer"
# to overwrite the docker.io/library/fedora:28 value.
docker build --progress plain --target runtime \
--label "[email protected]" \
--label "org.opencontainers.image.description=FUSE-based DAV client with extensions for performance" \
--label "org.opencontainers.image.licenses=GPLv2" \
--label "org.opencontainers.image.source=https://github.com/pantheon-systems/fusedav" \
--label "org.opencontainers.image.vendor=Pantheon Systems, Inc." \
--label "org.opencontainers.image.version=${SEMVER}" \
-t fusedav .
echo DONE build final image
for tag in ${IMAGE_TAGS[@]}; do
echo "tag image as ${tag}"
docker tag fusedav $tag
done
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push final image/tag(s) to container registry
run: |
. new-version.sh
for tag in ${IMAGE_TAGS[@]}; do
echo "push ${tag}"
docker push $tag
done
- name: Create (pre-release) GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. new-version.sh
# If NOT master, create a pre-release.
# Note that GitHub converts the tilde (`~`) which indicates a pre-release
# RPM version to a period (`.`) in the filename. This should not affect
# RPM version comparison operations.
echo "Create pre-release release:"
gh release create $GITHUB_RELEASE_NAME -p --generate-notes --target $GITHUB_REF_NAME
. scripts/upload-gh-assets.sh
if: github.ref != 'refs/heads/master'
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. new-version.sh
# Iff master, create a regular release.
echo "Create regular release:"
gh release create $GITHUB_RELEASE_NAME --generate-notes
. scripts/upload-gh-assets.sh
if: github.ref == 'refs/heads/master'