diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fde8159b3c..7a7416b5e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,17 +6,17 @@ on: - master - release-* pull_request: {} - workflow_dispatch: {} + workflow_dispatch: + inputs: + version: + description: 'Release version (e.g. v0.1.0)' + required: false env: # Common versions GO_VERSION: '1.18' GOLANGCI_VERSION: 'v1.47.1' DOCKER_BUILDX_VERSION: 'v0.8.2' - - # Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run - # a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether - # credentials have been provided before trying to run steps that need them. DOCKER_USR: ${{ github.actor }} jobs: @@ -302,12 +302,22 @@ jobs: - name: Vendor Dependencies run: make vendor vendor.check - - name: Build Artifacts + - name: Build Artifacts with Version + run: make -j2 build.all VERSION=${XPKG_VERSION} + if: env.XPKG_VERSION != '' + env: + # We're using docker buildx, which doesn't actually load the images it + # builds by default. Specifying --load does so. + BUILD_ARGS: "--load" + XPKG_VERSION: ${{ github.event.inputs.version }} + + - name: Build Artifacts without Version 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" + XPKG_VERSION: ${{ github.event.inputs.version }} - name: Publish Artifacts to GitHub uses: actions/upload-artifact@v2 @@ -323,11 +333,19 @@ jobs: username: ${{ secrets.DOCKER_USR }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Publish Artifacts to GHCR + - name: Publish Artifacts to GHCR with Version + run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} VERSION=${XPKG_VERSION} + if: env.DOCKER_USR != '' && env.XPKG_VERSION != '' + env: + GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + XPKG_VERSION: ${{ github.event.inputs.version }} + + - name: Publish Artifacts to GHCR without Version run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} - if: env.DOCKER_USR != '' + if: env.DOCKER_USR != '' && env.XPKG_VERSION == '' env: GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + XPKG_VERSION: ${{ github.event.inputs.version }} - name: Promote Artifacts in Docker Hub if: github.ref == 'refs/heads/master' && env.DOCKER_USR != ''