diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 133fb73..1a36784 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,12 +6,27 @@ on: version: type: string description: Version - default: 1.8 + default: 1.9 required: false jobs: - build: + set-build-env: runs-on: ubuntu-latest + outputs: + buildId: ${{ env.BUILD_NUMBER }} + now: ${{ env.NOW }} + steps: + - name: Version + run: | + VER="${{ github.event.inputs.version }}.${{ github.run_number }}" + echo "BUILD_NUMBER=${VER}" >> $GITHUB_ENV + + - name: Set current date as env variable + run: echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + + build-per-tool: + runs-on: ubuntu-latest + needs: set-build-env strategy: matrix: feature: [aws, azure, minio, rclone] @@ -28,13 +43,6 @@ jobs: arg: EN_RCLONE=true steps: - uses: actions/checkout@v3 - - name: Version - run: | - VER="${{ github.event.inputs.version }}.${{ github.run_number }}" - echo "BUILD_NUMBER=${VER}" >> $GITHUB_ENV - - - name: Set current date as env variable - run: echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -48,31 +56,46 @@ jobs: - name: Build and push Docker images uses: docker/build-push-action@v3 with: - labels: ${{ env.BUILD_NUMBER }} + labels: ${{ needs.set-build-env.outputs.buildId }} push: ${{ github.event_name != 'pull_request' }} tags: | - ${{ github.repository }}:${{ env.BUILD_NUMBER }}-${{ matrix.feature }} + ${{ github.repository }}:${{ needs.set-build-env.outputs.buildId }}-${{ matrix.feature }} build-args: | - BUILD_DATE=${{ env.NOW }} + BUILD_DATE=${{ needs.set-build-env.outputs.now }} VCS_REF=${{ github.sha }} - VERSION=${{ env.BUILD_NUMBER }} + VERSION=${{ needs.set-build-env.outputs.buildId }} EN_GPG=true ${{ matrix.arg }} cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/mgob:buildcache cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/mgob:buildcache,mode=max + build-all: + runs-on: ubuntu-latest + needs: [set-build-env, build-per-tool] + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push Docker images uses: docker/build-push-action@v3 with: - labels: ${{ env.BUILD_NUMBER }} + labels: ${{ needs.set-build-env.outputs.buildId }} push: ${{ github.event_name != 'pull_request' }} tags: | - ${{ github.repository }}:${{ env.BUILD_NUMBER }}-all + ${{ github.repository }}:${{ needs.set-build-env.outputs.buildId }}-all ${{ github.repository }}:latest build-args: | BUILD_DATE=${{ env.NOW }} VCS_REF=${{ github.sha }} - VERSION=${{ env.BUILD_NUMBER }} + VERSION=${{ needs.set-build-env.outputs.buildId }} EN_AWS_CLI=true EN_AZURE=true EN_GCLOUD=false @@ -85,5 +108,5 @@ jobs: - name: Release uses: softprops/action-gh-release@v1 with: - tag_name: ${{ env.BUILD_NUMBER }} + tag_name: ${{ needs.set-build-env.outputs.buildId }} generate_release_notes: true