-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (75 loc) · 2.63 KB
/
release.yml
File metadata and controls
87 lines (75 loc) · 2.63 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
77
78
79
80
81
82
83
84
85
86
87
name: Release Workflow
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+' # Push events to matching semantic tag
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Update container in operator.json
run: |
jq --arg variable "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/}" '.container = $variable' operator.json > operator.json.tmp
mv operator.json.tmp operator.json
- name: Log in to the Container registry
uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=pep440,pattern={{version}}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6.7.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Uncomment and add PAT if needed
# secrets: |
# github_pat=${{ secrets.GH_PAT }}
- name: Pull tercenctl
run: docker pull tercen/tercenctl:release
- name: Install operator
run: |
docker run --rm \
-e TERCEN_USERNAME=${{ secrets.TERCEN_TEST_OPERATOR_USERNAME }} \
-e TERCEN_PASSWORD=${{ secrets.TERCEN_TEST_OPERATOR_PASSWORD }} \
-e TERCEN_URI=${{ secrets.TERCEN_TEST_OPERATOR_URI }} \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
tercen/tercenctl:release operator install --rm --tag ${GITHUB_SHA} --repo ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Create required package.json
run: echo '{}' > package.json
- name: Build changelog
id: Changelog
uses: tercen/generate-changelog-action@master
- name: Create release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{steps.Changelog.outputs.changelog}}
draft: false
prerelease: false