-
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (104 loc) · 4.65 KB
/
release.yml
File metadata and controls
117 lines (104 loc) · 4.65 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Create release # You may choose a different name
run-name: ${{ inputs.releaseversion }} # Enumerates entries in the "workflow runs" view
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
type: string
default: "X.Y.Z"
jobs:
release: # Arbitrarily chosen
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.head_ref }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Configure Git author
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: Setup NodeJS
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Package Application
run: |
npm run clean
npm version --no-git-tag-version ${{ github.event.inputs.releaseversion }}
npm run build
- name: Write version vars
run: |
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
BRANCH=${GITHUB_REF_NAME#v}
APP_VERSION=$(cat package.json | grep version| head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')
echo Version: $APP_VERSION
echo "VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
- name: Conventional Changelog Action
uses: TriPSs/conventional-changelog-action@v6
with:
input-file: CHANGELOG.md
github-token: ${{ steps.app-token.outputs.token }}
version-file: package.json
pre-release: true
skip-bump: true
skip-tag: true
skip-on-empty: true
tag-prefix: 'v'
- name: Create Release on GH
id: tag-and-release
uses: avakar/tag-and-release@v1.0.0
with:
draft: true
release_name: ${{ github.event.inputs.releaseversion }}
tag_name: v${{ github.event.inputs.releaseversion }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Container Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: continuoussecuritytooling/ajv-cli
tags: 'latest ${{ github.event.inputs.releaseversion }}'
containerfiles: |
./Dockerfile
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
APP_VERSION=${{ github.event.inputs.releaseversion }}
- name: Push To Docker Hub
id: push-to-dockerhub-preview
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: 'latest ${{ github.event.inputs.releaseversion }}'
registry: registry.hub.docker.com
username: continuoussecuritytooling
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Publish npm package
run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}