-
-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (93 loc) · 3.42 KB
/
release.yaml
File metadata and controls
95 lines (93 loc) · 3.42 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
# This file was generated using Kotlin DSL (.github/workflows/release.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/typesafegithub/github-workflows-kt
name: 'Release'
on:
workflow_dispatch:
inputs:
version:
description: 'Used for the tag and the version name. E.g. v1.2.3.'
type: 'string'
required: true
jobs:
check_yaml_consistency:
name: 'Check YAML consistency'
runs-on: 'ubuntu-latest'
steps:
- id: 'step-0'
name: 'Check out'
uses: 'actions/checkout@v6'
- id: 'step-1'
name: 'Execute script'
run: 'rm ''.github/workflows/release.yaml'' && ''.github/workflows/release.main.kts'''
- id: 'step-2'
name: 'Consistency check'
run: 'git diff --exit-code ''.github/workflows/release.yaml'''
release:
runs-on: 'ubuntu-latest'
needs:
- 'check_yaml_consistency'
steps:
- id: 'step-0'
name: 'Checkout github-actions-typing'
uses: 'actions/checkout@v6'
with:
path: 'github-actions-typing'
- id: 'step-1'
name: 'Checkout github-actions-typing-catalog'
uses: 'actions/checkout@v6'
with:
repository: 'typesafegithub/github-actions-typing-catalog'
path: 'github-actions-typing-catalog'
- id: 'step-2'
uses: 'gradle/actions/setup-gradle@v5'
- id: 'step-3'
working-directory: 'github-actions-typing'
run: './gradlew build'
- id: 'step-4'
name: 'Regenerate the contents of dist directory'
working-directory: 'github-actions-typing'
run: |-
set -euxo pipefail
rm -rf dist
unzip -qq build/distributions/github-actions-typing.zip -d dist
- id: 'step-5'
name: 'Configure git'
working-directory: 'github-actions-typing'
run: |-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- id: 'step-6'
name: 'Commit changes to temp branch'
working-directory: 'github-actions-typing'
run: |-
git checkout -b temp-branch-for-release
git add .
git commit -m "Update dist"
- id: 'step-7'
name: 'Push commit'
working-directory: 'github-actions-typing'
run: 'git push --set-upstream origin temp-branch-for-release'
- id: 'step-8'
name: 'Create and push a patch version tag'
working-directory: 'github-actions-typing'
run: |-
git tag -a "${{ github.event.inputs.version }}" -m "Release version ${{ github.event.inputs.version }}"
git push origin "${{ github.event.inputs.version }}"
- id: 'step-9'
name: 'Extract major version'
env:
GHWKT_GITHUB_CONTEXT_JSON: '${{ toJSON(github) }}'
working-directory: 'github-actions-typing'
run: 'GHWKT_RUN_STEP=''release.yaml:release:step-9'' ''.github/workflows/release.main.kts'''
- id: 'step-10'
name: 'Create or update a major version branch'
working-directory: 'github-actions-typing'
run: |-
git branch -D "${{ steps.step-9.outputs.majorVersion }}" || true
git checkout -b "${{ steps.step-9.outputs.majorVersion }}"
git push origin "${{ steps.step-9.outputs.majorVersion }}" -f
- id: 'step-11'
name: 'Delete temp branch'
working-directory: 'github-actions-typing'
run: 'git push origin --delete temp-branch-for-release'