-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.42 KB
/
image.yml
File metadata and controls
52 lines (45 loc) · 1.42 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
name: Image
on:
workflow_call:
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/${{ github.repository_owner }}/osa
jobs:
build:
name: Build & Push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute tags
id: tags
run: |
SHA_SHORT=$(echo "${{ github.sha }}" | cut -c1-7)
TAGS="${{ env.IMAGE }}:sha-${SHA_SHORT}"
if [[ "${{ github.event_name }}" == "release" ]]; then
TAGS="${TAGS},${{ env.IMAGE }}:${{ github.event.release.tag_name }}"
fi
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
TAGS="${TAGS},${{ env.IMAGE }}:pr-${{ github.event.pull_request.number }}"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v7
with:
context: server
push: true
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
OSA_VERSION=${{ github.event.release.tag_name || github.sha }}
OSA_REVISION=${{ github.sha }}