Update build.yml

This commit is contained in:
Sébastien Clément 2022-06-29 16:43:29 +02:00 committed by GitHub
parent c376d376dd
commit 7965a42ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,6 @@ name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-gradle:
@ -38,7 +35,6 @@ jobs:
runs-on: ubuntu-latest
needs:
- build-gradle
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
@ -60,10 +56,24 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5.2
- name: Set tag master
if: steps.branch-name.outputs.current_branch == 'master'
run: |
echo "tag=latest" >> $GITHUB_ENV
- name: Set tag
if: steps.branch-name.outputs.current_branch != 'master'
run: |
echo "tag=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_ENV
- name: Build and push Docker
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: ghcr.io/sebclem/claptrapbot:latest
file: ./Dockerfile
tags: "ghcr.io/sebclem/claptrapbot:${{ env.tag }}"
file: ./Dockerfile