Skip to content

Release

Release #21

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
type: string
description: Version
default: 2.0
required: false
jobs:
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, gcloud, minio, rclone]
include:
- feature: aws
arg: EN_AWS_CLI=true
- feature: azure
arg: EN_AZURE=true
- feature: gcloud
arg: EN_GCLOUD=true
- feature: minio
arg: EN_MINIO=true
- feature: rclone
arg: EN_RCLONE=true
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: ${{ needs.set-build-env.outputs.buildId }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ github.repository }}:${{ needs.set-build-env.outputs.buildId }}-${{ matrix.feature }}
build-args: |
BUILD_DATE=${{ needs.set-build-env.outputs.now }}
VCS_REF=${{ github.sha }}
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]
permissions:
contents: write
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: ${{ needs.set-build-env.outputs.buildId }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ github.repository }}:${{ needs.set-build-env.outputs.buildId }}-all
${{ github.repository }}:${{ needs.set-build-env.outputs.buildId }}
${{ github.repository }}:latest
build-args: |
BUILD_DATE=${{ env.NOW }}
VCS_REF=${{ github.sha }}
VERSION=${{ needs.set-build-env.outputs.buildId }}
EN_AWS_CLI=true
EN_AZURE=true
EN_GCLOUD=true
EN_MINIO=true
EN_RCLONE=true
EN_GPG=true
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/mgob:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/mgob:buildcache,mode=max
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.set-build-env.outputs.buildId }}
generate_release_notes: true