forked from WaterdogPE/WaterdogPE
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.76 KB
/
maven-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Build and Publish
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
branches:
- '**'
jobs:
build:
env:
DOCKER_DEPLOY: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/waterdog-2' }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: ./.github/actions/build
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
perform_deploy: ${{ env.DOCKER_DEPLOY }}
deploy_repository: "waterdog-snapshots"
deploy_username: ${{ secrets.DEPLOY_USERNAME }}
deploy_password: ${{ secrets.DEPLOY_PASSWORD }}
create_prerelease: ${{ github.ref == 'refs/heads/master' }}
prerelease_name: "latest"
- name: Docker Login
uses: docker/login-action@v1
if: ${{ env.DOCKER_DEPLOY == 'true' }}
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
if: ${{ env.DOCKER_DEPLOY == 'true' }}
with:
images: "ghcr.io/${{ github.repository }}"
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Docker build and push
uses: docker/build-push-action@v4
if: ${{ env.DOCKER_DEPLOY == 'true' && github.event_name != 'pull_request' }}
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}