Repository navigation
49 lines (44 loc) · 1.73 KB
/
Copy pathnode-ci.dev.yml
File metadata and controls
49 lines (44 loc) · 1.73 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
#######################################################################################################################
#
# Dev / Test Image Publish
#
# Manual workflow_dispatch. Builds and publishes a container image for any branch.
# Image tag: {sanitized-branch}-{short-sha}
#
#######################################################################################################################
name: Dev Node CI
permissions:
contents: read
packages: write
on:
workflow_dispatch:
jobs:
resolve-tag:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tag.outputs.tags }}
steps:
- name: Access repository
uses: actions/checkout@v4
- name: Compute image tag
id: tag
shell: bash
env:
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
SAFE_BRANCH=$(echo "$REF_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]/-/g; s/--*/-/g; s/^-//; s/-$//')
SHORT_SHA=$(git rev-parse --short=7 HEAD)
if [ -z "$SHORT_SHA" ]; then
echo "Failed to resolve commit SHA" >&2
exit 1
fi
IMAGE_TAG="${SAFE_BRANCH}-${SHORT_SHA}"
echo "tags=type=raw,value=${IMAGE_TAG}" >> "$GITHUB_OUTPUT"
echo "Using image tag: ghcr.io/${GITHUB_REPOSITORY,,}:${IMAGE_TAG}"
publish-container-image:
needs: resolve-tag
uses: ./.github/workflows/publish-container-image.yml
secrets: inherit
with:
tags: ${{ needs.resolve-tag.outputs.tags }}