Skip to content

Commit

Permalink
feat: devops, improve release build process
Browse files Browse the repository at this point in the history
  • Loading branch information
maxisam committed Nov 2, 2022
1 parent d145806 commit 6f2993b
Showing 1 changed file with 40 additions and 17 deletions.
57 changes: 40 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 6f2993b

Please sign in to comment.