publish-ocm-cli #2
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 publish step takes care of some (but not all ;) ) of the package registries | |
# that we think might be useful for people to consume. | |
# | |
# Other package registries might also be pushed in the goreleaser step (see release.yaml) and are configured | |
# within .github/config/goreleaser.yaml. | |
# | |
# TODO: Unify | |
name: Publish Release to other package registries than Github | |
on: | |
repository_dispatch: | |
types: [publish-ocm-cli] | |
jobs: | |
push-to-aur: | |
name: Update Arch Linux User Repository | |
if: github.event.client_payload.push-to-aur && github.event.client_payload.version != '' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Ensure proper version | |
run: echo "RELEASE_VERSION=$(echo ${{ github.event.client_payload.version }} | tr -d ['v'])" >> $GITHUB_ENV | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
name: aur | |
key: ${{ secrets.ARCHLINUX_SSH_PRIVATE_KEY }} | |
known_hosts: ${{ secrets.ARCHLINUX_KNOWN_HOSTS }} | |
config: ${{ secrets.ARCHLINUX_SSH_CONFIG}} | |
- name: Git operations with SSH | |
run: | | |
git clone ssh://aur@aur.archlinux.org/ocm-cli.git | |
cd ocm-cli | |
git config user.name "ocm.software" | |
git config user.email "ocm@sap.com" | |
./upgrade ${{ env.RELEASE_VERSION }} | |
git add PKGBUILD .SRCINFO | |
git commit -m "Release ${{ env.RELEASE_VERSION }}" | |
git push origin @:refs/heads/master | |
push-to-chocolatey: | |
name: Update Chocolatey | |
if: github.event.client_payload.push-to-chocolatey && github.event.client_payload.version != '' | |
runs-on: windows-latest | |
steps: | |
- name: Ensure proper version | |
run: | | |
$version = "${{ github.event.client_payload.version }}" -replace 'v' | |
echo "RELEASE_VERSION=$version" | Out-File $env:GITHUB_ENV | |
- 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: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
- name: Update Chocolatey package | |
run: | | |
.\hack\chocolatey\update.ps1 | |
choco push ocm-cli.${{ env.RELEASE_VERSION }}.nupkg --source "'https://push.chocolatey.org/'" --api-key="${{ secrets.CHOCO_API_KEY }}" | |
push-to-winget: | |
name: Update Winget | |
if: github.event.client_payload.push-to-winget && github.event.client_payload.version != '' | |
runs-on: windows-latest | |
steps: | |
- name: Ensure proper version | |
run: | | |
$version = "${{ github.event.client_payload.version }}" -replace 'v' | |
echo "RELEASE_VERSION=$version" | Out-File $env:GITHUB_ENV | |
- 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: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
- name: Install wingetcreate | |
run: choco install wingetcreate | |
- name: Update Winget package | |
run: | | |
cd hack\winget | |
wingetcreate update --submit --token ${{ steps.generate_token.outputs.token }} --urls ` | |
https://github.com/open-component-model/ocm/releases/download/v${{ env.RELEASE_VERSION }}/ocm-${{ env.RELEASE_VERSION }}-windows-amd64.zip ` | |
https://github.com/open-component-model/ocm/releases/download/v${{ env.RELEASE_VERSION }}/ocm-${{ env.RELEASE_VERSION }}-windows-arm64.zip ` | |
--version ${{ env.RELEASE_VERSION }} ` | |
Open-Component-Model.ocm-cli |