Merge remote-tracking branch 'origin/master' #638
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: rhythm-builder | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# schedule: | |
# - cron: "0 0 * * */3" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
tags: | |
description: 'Test scenario tags' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
amd64-build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Get current date | |
id: date | |
run: echo "::set-output name=today::$(date +'%Y-%m-%d')" | |
- name: Prepare | |
id: prep | |
run: | | |
TAG=$(echo $GITHUB_REF | cut -d / -f 3) | |
IMAGE="tangcuyu/rhythm" | |
echo ::set-output name=image::${IMAGE} | |
echo ::set-output name=tag::${TAG} | |
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- | |
name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- | |
name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
# - | |
# name: Login to DockerHub | |
# uses: docker/login-action@v1 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
# push: ${{ github.event_name != 'pull_request' }} | |
push: false | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
tags: | | |
${{ steps.prep.outputs.image }}:amd64-${{ steps.date.outputs.today }} | |
${{ steps.prep.outputs.image }}:amd64-${{ steps.prep.outputs.tag }} | |
${{ steps.prep.outputs.image }}:latest | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |