forked from open-component-model/ocm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathretrigger-publish-to-other.yaml
More file actions
65 lines (63 loc) · 2.7 KB
/
retrigger-publish-to-other.yaml
File metadata and controls
65 lines (63 loc) · 2.7 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
name: Manually retrigger the publishing of ocm-cli to other repositories
on:
workflow_dispatch:
inputs:
version:
type: string
description: Which version (e.g. v0.42.0) do you want to publish?
required: true
default: ''
push-to-aur:
type: boolean
description: Do you want to push to the Arch Linux User Repository?
required: false
default: false
push-to-chocolatey:
type: boolean
description: Do you want to push to Chocolatey?
required: false
default: false
push-to-brew-tap:
type: boolean
description: Do you want to push to the Homebrew Tap at https://github.com/open-component-model/homebrew-tap?
required: false
default: false
push-to-website:
type: boolean
description: Do you want to push an update to the OCM website?
required: false
default: false
jobs:
retrigger:
name: Create new "Release Publish Event"
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
with:
app_id: ${{ secrets.OCMBOT_APP_ID }}
private_key: ${{ secrets.OCMBOT_PRIV_KEY }}
- name: Ensure proper version
run: |
curl -sSL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/open-component-model/ocm/releases > releases.json
jq -r '.[] | .tag_name' releases.json | grep -v -E '.*-rc|latest' > versions.txt
if grep -Fxq '${{ github.event.inputs.version }}' versions.txt; then
echo "Version (${{ github.event.inputs.version }}) found!"
else
echo "Version (${{ github.event.inputs.version }}) not found! This are the availble ones:"
cat versions.txt
exit 1
fi
echo "RELEASE_VERSION=$(echo ${{ github.event.inputs.version }} )" >> $GITHUB_ENV
- name: Publish Event
uses: peter-evans/repository-dispatch@5fc4efd1a4797ddb68ffd0714a238564e4cc0e6f # v4.0.0
with:
token: ${{ steps.generate_token.outputs.token }}
repository: ${{ github.repository_owner }}/ocm
event-type: publish-ocm-cli
client-payload: '{"version":"${{ env.RELEASE_VERSION }}","push-to-website":${{ github.event.inputs.push-to-website }},"push-to-aur":${{ github.event.inputs.push-to-aur }},"push-to-chocolatey":${{ github.event.inputs.push-to-chocolatey }},"push-to-brew-tap":${{ github.event.inputs.push-to-brew-tap }}}'