From b31419c8de3d85c05add58fee985b49ce65b9653 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Wed, 14 Dec 2022 11:29:08 +0000 Subject: [PATCH] Fix CI for deprecated set_output Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- .github/workflows/build.yml | 42 ++++++++++++++++++----------- .github/workflows/publish.yml | 51 ++++++++++++++++++++++++----------- 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 593cc321..21a2049c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,17 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Get TAG - id: get_tag - run: echo ::set-output name=TAG::latest-dev + + - name: Get git commit + id: get_git_commit + run: echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Get version + id: get_version + run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV - name: Get Repo Owner id: get_repo_owner - run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV + - name: Build ${{ matrix.svc }} uses: docker/build-push-action@v2 with: @@ -37,18 +42,18 @@ jobs: outputs: "type=image,push=false" platforms: linux/amd64,linux/arm/v7,linux/arm64 build-args: | - VERSION=${{ steps.get_tag.outputs.TAG }} + VERSION=${{ env.TAG }} GIT_COMMIT=${{ github.sha }} tags: | - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ steps.get_tag.outputs.TAG }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ github.sha }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:latest + ghcr.io/${{ env.REPO_OWNER }}/gateway:${{ github.sha }} + ghcr.io/${{ env.REPO_OWNER }}/gateway:${{ env.TAG }} + ghcr.io/${{ env.REPO_OWNER }}/gateway:latest build-auth-plugins: runs-on: ubuntu-latest strategy: matrix: - go-version: [1.17.x] + go-version: [1.19.x] svc: [ basic-auth ] @@ -60,12 +65,17 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Get TAG - id: get_tag - run: echo ::set-output name=TAG::latest-dev + + - name: Get git commit + id: get_git_commit + run: echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Get version + id: get_version + run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV - name: Get Repo Owner id: get_repo_owner - run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV + - name: Build ${{ matrix.svc }} uses: docker/build-push-action@v2 with: @@ -74,6 +84,6 @@ jobs: outputs: "type=image,push=false" platforms: linux/amd64,linux/arm/v7,linux/arm64 tags: | - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:${{ steps.get_tag.outputs.TAG }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:${{ github.sha }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:latest + ghcr.io/${{ env.REPO_OWNER }}/${{ matrix.svc }}:${{ github.sha }} + ghcr.io/${{ env.REPO_OWNER }}/${{ matrix.svc }}:${{ env.TAG }} + ghcr.io/${{ env.REPO_OWNER }}/${{ matrix.svc }}:latest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5b501cd9..ac74f7db 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,14 +24,23 @@ jobs: uses: docker/login-action@v1 with: username: ${{ github.repository_owner }} - password: ${{ secrets.DOCKER_PASSWORD }} + password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io + - name: Get TAG id: get_tag - run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} + run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV + + - name: Get git commit + id: get_git_commit + run: echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Get version + id: get_version + run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV - name: Get Repo Owner id: get_repo_owner - run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV + - name: Publish ${{ matrix.svc }} uses: docker/build-push-action@v2 with: @@ -40,17 +49,18 @@ jobs: outputs: "type=registry,push=true" platforms: linux/amd64,linux/arm/v7,linux/arm64 build-args: | - VERSION=${{ steps.get_tag.outputs.TAG }} + VERSION=${{ env.TAG }} GIT_COMMIT=${{ github.sha }} tags: | - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ steps.get_tag.outputs.TAG }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ github.sha }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:latest + ghcr.io/${{ env.REPO_OWNER }}/gateway:${{ github.sha }} + ghcr.io/${{ env.REPO_OWNER }}/gateway:${{ env.TAG }} + ghcr.io/${{ env.REPO_OWNER }}/gateway:latest + publish-auth-plugins: runs-on: ubuntu-latest strategy: matrix: - go-version: [1.17.x] + go-version: [1.19.x] svc: [ basic-auth ] @@ -62,18 +72,27 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Get TAG - id: get_tag - run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} - name: Login to Docker Registry uses: docker/login-action@v1 with: username: ${{ github.repository_owner }} - password: ${{ secrets.DOCKER_PASSWORD }} + password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io + + - name: Get TAG + id: get_tag + run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV + + - name: Get git commit + id: get_git_commit + run: echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Get version + id: get_version + run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV - name: Get Repo Owner id: get_repo_owner - run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV + - name: Publish ${{ matrix.svc }} uses: docker/build-push-action@v2 with: @@ -82,6 +101,6 @@ jobs: outputs: "type=registry,push=true" platforms: linux/amd64,linux/arm/v7,linux/arm64 tags: | - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:${{ steps.get_tag.outputs.TAG }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:${{ github.sha }} - ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:latest + ghcr.io/${{ env.REPO_OWNER }}/${{ matrix.svc }}:${{ github.sha }} + ghcr.io/${{ env.REPO_OWNER }}/${{ matrix.svc }}:${{ env.TAG }} + ghcr.io/${{ env.REPO_OWNER }}/${{ matrix.svc }}:latest