Repository navigation
77 lines (64 loc) · 2.25 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (64 loc) · 2.25 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
jobs:
publish-package:
name: Publish package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Orun
uses: sourceplane/orun-action@v1.2.0
with:
version: v2.69.0
- name: Make helper scripts executable
run: chmod +x scripts/*.sh
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Derive release version
shell: bash
run: |
stack_version="$(awk '/^ version: /{print $2}' stack.yaml)"
tag_version="${GITHUB_REF_NAME#v}"
test -n "${stack_version}"
test "${stack_version}" = "${tag_version}"
echo "STACK_VERSION=${stack_version}" >> "${GITHUB_ENV}"
- name: Verify catalog
run: ./scripts/verify.sh
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
echo "Release ${GITHUB_REF_NAME} already exists."
exit 0
fi
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--generate-notes
# Runs after the release so the tag and release notes are the record of
# record before the immutable artifact is pushed. The target is passed
# explicitly: with no ref, orun infers ghcr.io/<owner>/<repo>/<package>
# from the git remote, which is the wrong repository path.
- name: Publish OCI package
run: |
orun publish "ghcr.io/sourceplane/stack-granite:${STACK_VERSION}" \
--root . \
--version "${STACK_VERSION}"
- name: Confirm package is pullable
run: |
orun fetch "ghcr.io/sourceplane/stack-granite:${STACK_VERSION}" \
--output "${RUNNER_TEMP}/published" --overwrite
test -f "${RUNNER_TEMP}/published/stack.yaml"
echo "published $(ls "${RUNNER_TEMP}/published/compositions" | wc -l) composition(s)"