diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 97339dba1..86526cba5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -208,8 +208,7 @@ jobs: uses: docker/metadata-action@v5 with: images: - ${{ steps.login.outputs.registry }}/firezone/${{ - matrix.name.artifact }} + ${{ steps.login.outputs.registry }}/firezone/${{matrix.name.artifact }} tags: | type=raw,value=${{ github.sha }} type=raw,value=${{ env.VERSION }} @@ -230,8 +229,7 @@ jobs: type=registry,ref=${{ steps.login.outputs.registry }}/cache/${{ matrix.name.artifact }}:main,mode=max target: release outputs: - type=image,name=${{ steps.login.outputs.registry }}/firezone/${{ - matrix.name.artifact}},push-by-digest=true,name-canonical=true,push=true + type=image,name=${{ steps.login.outputs.registry }}/firezone/${{matrix.name.artifact}},push-by-digest=true,name-canonical=true,push=true - name: Export digest run: | mkdir -p /tmp/digests/${{ matrix.name.artifact }} @@ -270,16 +268,25 @@ jobs: path: /tmp/digests - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build Version Tags + run: | + set -xe + MAJOR_VERSION="${VERSION%%.*}" + MAJOR_MINOR_VERSION="${VERSION%.*}" + + echo "MAJOR_VERSION=${MAJOR_VERSION}" >> $GITHUB_ENV + echo "MAJOR_MINOR_VERSION=${MAJOR_MINOR_VERSION}" >> $GITHUB_ENV - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: - ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name - }} + ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name }} tags: | type=raw,value=${{ github.sha }} type=raw,value=${{ env.VERSION }} + type=raw,value=${{ env.MAJOR_VERSION }} + type=raw,value=${{ env.MAJOR_MINOR_VERSION }} - name: Create manifest list and push working-directory: /tmp/digests/${{ matrix.image_name }} run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4951f87d..b01e768c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,14 @@ jobs: id: login with: project: firezone-staging + - name: Build Version Tags + run: | + set -xe + MAJOR_VERSION="${VERSION%%.*}" + MAJOR_MINOR_VERSION="${VERSION%.*}" + + echo "MAJOR_VERSION=${MAJOR_VERSION}" >> $GITHUB_ENV + echo "MAJOR_MINOR_VERSION=${MAJOR_MINOR_VERSION}" >> $GITHUB_ENV - name: Build Docker images uses: docker/build-push-action@v5 with: @@ -112,6 +120,8 @@ jobs: push: true target: ${{ matrix.target }} tags: | + ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name }}:${{ env.MAJOR_VERSION }} + ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name }}:${{ env.MAJOR_MINOR_VERSION }} ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name }}:${{ env.VERSION }}-${{ github.sha }} ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name }}:${{ env.BRANCH_TAG }} ${{ steps.login.outputs.registry }}/firezone/${{ matrix.image_name }}:${{ github.sha }}