-
-
Notifications
You must be signed in to change notification settings - Fork 4
105 lines (89 loc) · 3.58 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
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
99
100
101
102
103
104
105
name: release
on:
workflow_call:
inputs:
MsBuildVersion:
required: true
type: string
TagFor7000072:
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
fetch-depth: 0
- name: Ensure all TagForDbVersion outputs were present
env:
TAG72: ${{ inputs.TagFor7000072 }}
run: |
echo "Tag for FW9 (DbVersion 72): (${TAG72})"
- name: Tag release branches
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
TAG72: ${{ inputs.TagFor7000072 }}
run: |
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -f -a -m "Release ${TAG72}" "${TAG72}" "refs/remotes/origin/master"
git push -v origin "${TAG72}"
- name: Calculate Docker tags
id: docker_tag
env:
MS_BUILD_VERSION: ${{ inputs.MsBuildVersion }}
run: |
if [ "${GITHUB_REF}" = 'refs/heads/master' ]
then
TAGS=ghcr.io/sillsdev/lfmerge:${MS_BUILD_VERSION},ghcr.io/sillsdev/lfmerge:latest
else
TAGS=ghcr.io/sillsdev/lfmerge:${MS_BUILD_VERSION}
fi
echo "DockerTags=${TAGS}" >> $GITHUB_OUTPUT
- name: Download build artifacts
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
# No name specified, so will download all artifacts
path: all-tarballs
- name: Verify that download step worked
run: ls -lR all-tarballs
- name: Uncompress build artifacts
run: for f in all-tarballs/*/*.tar.gz; do gzip -cd "${f}" | tar xf -; done
- name: Verify that uncompress step worked
run: ls -lR tarball
- name: Login to GHCR
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build final Docker image
id: lfmerge_image
uses: docker/[email protected]
with:
push: ${{(github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'))}}
tags: ${{ steps.docker_tag.outputs.DockerTags }}
context: .
file: Dockerfile.finalresult
- name: Show metadata from LfMerge image build step
run: echo "$METADATA"
env:
METADATA: ${{ steps.lfmerge_image.outputs.metadata }}
- name: List Docker images to verify build
run: docker image ls
# During development, we'll want the Docker image as a build artifact
- name: Save Docker image to tarball
if: (!(github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))
run: docker image save "${TAG}" -o "lfmerge-${MS_BUILD_VERSION}.tar"
env:
MS_BUILD_VERSION: ${{ inputs.MsBuildVersion }}
TAG: ghcr.io/sillsdev/lfmerge:${{ inputs.MsBuildVersion }}
- name: Upload Docker image as build artifact
if: (!(github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: lfmerge-docker-${{ inputs.MsBuildVersion }}
path: lfmerge-${{ inputs.MsBuildVersion }}.tar
compression-level: 6