From 77dca128fcc4efe6a48c622205dd82ff9666f1c5 Mon Sep 17 00:00:00 2001 From: will Farrell Date: Wed, 2 Dec 2020 13:56:42 -0700 Subject: [PATCH] ci: update build to use no external scripts --- .github/workflows/github-build.yml | 47 ++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/github-build.yml b/.github/workflows/github-build.yml index 7deb96d..a94098c 100644 --- a/.github/workflows/github-build.yml +++ b/.github/workflows/github-build.yml @@ -1,33 +1,48 @@ -name: GitHub Actions CI +name: build on: push: branches: - main + tags: + - '*' schedule: - - cron: '0 6 * * *' + - cron: '0 0 * * *' jobs: - buildx: + multi: runs-on: ubuntu-latest steps: - - name: Checkout repo + - + name: Checkout uses: actions/checkout@v2 - - - name: Set up QEMU + - + name: Set up QEMU uses: docker/setup-qemu-action@v1 - - - uses: docker/setup-buildx-action@v1 - id: buildx - with: - install: true - - - name: Login to DockerHub + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build docker container - run: | - ./buildx.sh + - if: github.ref == 'refs/heads/main' + name: Conditional(Set tag as `latest`) + run: echo "tag=willfarrell/crontab:latest" >> $GITHUB_ENV + + - if: startsWith(github.ref, 'refs/tags/') + name: Conditional(Set tag as `{version}`) + run: echo "tag=willfarrell/crontab:${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ env.tag }}