Publish Provider Package #18
This file contains hidden or 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
| name: Publish Provider Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version string to use while publishing the package (e.g. v1.0.0-alpha.1)" | |
| default: '' | |
| required: false | |
| go-version: | |
| description: 'Go version to use if building needs to be done' | |
| default: '1.25' | |
| required: false | |
| docker-buildx-version: | |
| description: 'Docker Buildx version to use' | |
| default: 'v0.28.0' | |
| required: false | |
| env: | |
| VERSION: ${{ github.event.inputs.version }} | |
| GO_VERSION: ${{ github.event.inputs.go-version }} | |
| DOCKER_BUILDX_VERSION: ${{ github.event.inputs.docker-buildx-version }} | |
| jobs: | |
| publish-provider-package: | |
| runs-on: ubuntu-24.04 | |
| environment: publish | |
| steps: | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3 | |
| with: | |
| platforms: all | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| version: ${{ env.DOCKER_BUILDX_VERSION }} | |
| install: true | |
| - name: Install Upbound CLI | |
| run: | | |
| curl -sL "https://cli.upbound.io" | VERSION=current sh | |
| sudo mv up /usr/local/bin/ | |
| up version | |
| - name: Checkout | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
| with: | |
| submodules: true | |
| - name: Fetch History | |
| run: git fetch --prune --unshallow | |
| - name: Setup Go | |
| uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Find the Go Build Cache | |
| id: go | |
| run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT | |
| - name: Cache the Go Build Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.go.outputs.cache }} | |
| key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }} | |
| restore-keys: ${{ runner.os }}-build-publish-artifacts- | |
| - name: Cache Go Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .work/pkg | |
| key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
| restore-keys: ${{ runner.os }}-pkg- | |
| - name: Vendor Dependencies | |
| run: make vendor vendor.check | |
| - name: Build Artifacts | |
| run: make -j2 build.all | |
| env: | |
| # We're using docker buildx, which doesn't actually load the images it | |
| # builds by default. Specifying --load does so. | |
| BUILD_ARGS: "--load" | |
| - name: Publish Artifacts | |
| run: | | |
| up version | |
| up login --token ${{ secrets.UPBOUND_PAT }} | |
| up xpkg push -f _output/xpkg/linux_amd64/provider-cloudscale-${{ env.VERSION }}.xpkg xpkg.upbound.io/onzack-ag/provider-cloudscale:${{ env.VERSION }} | |
| up xpkg push -f _output/xpkg/linux_arm64/provider-cloudscale-${{ env.VERSION }}.xpkg xpkg.upbound.io/onzack-ag/provider-cloudscale:${{ env.VERSION }} |