-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: enhance the publishing to other repositories then github (#1028)
#### What this PR does / why we need it Publishing to external repositories might fail for various reasons, therefore we should be able to easily trigger the publishing to those repositories again and again without the need to rebuild a new release from scratch.
- Loading branch information
Showing
3 changed files
with
72 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
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-winget: | ||
type: boolean | ||
description: Do you want to push to Winget? | ||
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@v2 | ||
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@v3 | ||
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-aur":${{ github.event.inputs.push-to-aur }},"push-to-chocolatey":${{ github.event.inputs.push-to-chocolatey }},"push-to-winget":${{ github.event.inputs.push-to-winget }}}' |