Skip to content

Publish Provider Package #40

Publish Provider Package

Publish Provider Package #40

Workflow file for this run

name: Publish Provider Package
on:
workflow_dispatch:
inputs:
cleanup-disks:
description: Whether or not run the cleanup disks step in the runner
type: boolean
default: true
required: false
version:
description: Version string to use while publishing the package (e.g. v1.0.0-alpha.1)
default: ""
required: false
jobs:
infer-go-version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Read go version
id: read-go-version
run: echo "go-version=$(sed -n 's/^go //p' go.mod)" >> "$GITHUB_OUTPUT"
outputs:
go-version: ${{ steps.read-go-version.outputs.go-version }}
publish-provider-package:
needs: infer-go-version
uses: crossplane-contrib/provider-workflows/.github/workflows/publish-provider.yml@main
with:
cleanup-disk: ${{ inputs.cleanup-disks }}
go-version: ${{ needs.infer-go-version.outputs.go-version }}
repository: provider-mongodbatlas
version: ${{ github.event.inputs.version }}
secrets:
GHCR_PAT: ${{ secrets.GITHUB_TOKEN }}
XPKG_MIRROR_ACCESS_ID: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
XPKG_MIRROR_TOKEN: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}
tag-latest:
needs: publish-provider-package
runs-on: ubuntu-latest
steps:
- name: Login to GHCR
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install crane
uses: imjasonh/setup-crane@feee3b6bb0d4c68370f256a4502498c9227e5c6b # v0.7
- name: Tag latest
run: crane tag ghcr.io/crossplane-contrib/provider-mongodbatlas:${{ inputs.version }} latest
add-extensions:
needs:
- infer-go-version
- publish-provider-package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true
- name: Login to Upbound Marketplace
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: xpkg.upbound.io
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}
- name: Append extensions
run: make xpkg.append VERSION=${{ inputs.version }}
env:
GO_REQUIRED_VERSION: ${{ needs.infer-go-version.outputs.go-version }}
- name: Commit README if changed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${{ github.ref_type }}" != "branch" || "${{ github.ref_name }}" != "main" ]]; then
echo "Skipping README commit (only runs on main branch)"
exit 0
fi
if [ -n "$(git status --porcelain README.md)" ]; then
gh api graphql \
-F githubRepository=${{ github.repository }} \
-F branchName=${{ github.ref_name }} \
-F expectedHeadOid=$(git rev-parse HEAD) \
-F commitMessage="docs: update README.md" \
-F files[][path]="README.md" -F files[][contents]=$(base64 -w0 README.md) \
-F 'query=@.github/api/createCommitOnBranch.gql'
fi