-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.58 KB
/
build-image.yml
File metadata and controls
58 lines (52 loc) · 1.58 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
name: Build sandbox image
on:
push:
branches: [main, init]
paths:
- "docker/**"
- ".github/workflows/build-image.yml"
repository_dispatch:
types: [code-repo-updated]
workflow_dispatch:
inputs:
code_ref:
description: "Ref of workshop-nexus-intro-code to build against (branch, tag, or sha)"
required: false
default: "init"
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/temporalio/workshop-nexus-intro-sandbox
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Checkout workshop-nexus-intro-code
uses: actions/checkout@v4
with:
repository: temporalio/workshop-nexus-intro-code
path: workshop-nexus-intro-code
ref: ${{ github.event.inputs.code_ref || (github.ref_name == 'main' && 'main' || 'init') }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tags
id: tags
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
echo "extra=${{ env.IMAGE }}:latest" >> "$GITHUB_OUTPUT"
else
echo "extra=${{ env.IMAGE }}:${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: |
${{ steps.tags.outputs.extra }}
${{ env.IMAGE }}:${{ github.sha }}