diff options
author | thursday <xthursdayx@mailbox.org> | 2021-11-16 04:34:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 04:34:02 -0500 |
commit | f28745711a7cba594d5d6c00223aed9aa450f8be (patch) | |
tree | 0701c6c96f7b4f39570960b6596f9c05ad37443a /.github/workflows | |
parent | Merge pull request #2 from getferdi/master (diff) | |
download | ferdium-server-f28745711a7cba594d5d6c00223aed9aa450f8be.tar.gz ferdium-server-f28745711a7cba594d5d6c00223aed9aa450f8be.tar.zst ferdium-server-f28745711a7cba594d5d6c00223aed9aa450f8be.zip |
Create build-and-publish.yml
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build-and-publish.yml | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..bcd4d48 --- /dev/null +++ b/.github/workflows/build-and-publish.yml | |||
@@ -0,0 +1,68 @@ | |||
1 | name: Build and Publish | ||
2 | |||
3 | on: | ||
4 | # push: | ||
5 | # branches: | ||
6 | # - 'main' | ||
7 | tags: | ||
8 | - 'v*.*.*' | ||
9 | # pull_request: | ||
10 | # branches: | ||
11 | # - 'main' | ||
12 | workflow_dispatch: | ||
13 | |||
14 | jobs: | ||
15 | image-build: | ||
16 | runs-on: ubuntu-latest | ||
17 | steps: | ||
18 | - name: Checkout | ||
19 | uses: actions/checkout@v2 | ||
20 | |||
21 | - name: Docker meta | ||
22 | id: meta | ||
23 | uses: docker/metadata-action@v3 | ||
24 | with: | ||
25 | images: | | ||
26 | ${{ github.repository }} | ||
27 | ghcr.io/${{ github.repository }} | ||
28 | tags: | | ||
29 | type=ref,event=branch | ||
30 | type=ref,event=pr | ||
31 | type=semver,pattern={{version}} | ||
32 | type=semver,pattern={{major}}.{{minor}} | ||
33 | type=semver,pattern={{major}} | ||
34 | |||
35 | - name: Set up QEMU | ||
36 | uses: docker/setup-qemu-action@v1 | ||
37 | |||
38 | - name: Set up Docker Buildx | ||
39 | uses: docker/setup-buildx-action@v1 | ||
40 | |||
41 | - name: Login to DockerHub | ||
42 | if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} | ||
43 | uses: docker/login-action@v1 | ||
44 | with: | ||
45 | username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
46 | password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
47 | |||
48 | - name: Login to GitHub Container Registry | ||
49 | if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} | ||
50 | uses: docker/login-action@v1 | ||
51 | with: | ||
52 | registry: ghcr.io | ||
53 | username: ${{ github.repository_owner }} | ||
54 | password: ${{ secrets.GITHUB_TOKEN }} | ||
55 | |||
56 | - name: Build and push | ||
57 | id: docker_build | ||
58 | uses: docker/build-push-action@v2 | ||
59 | with: | ||
60 | context: . | ||
61 | file: ./Dockerfile | ||
62 | platforms: linux/amd64,linux/arm64 | ||
63 | push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} | ||
64 | tags: ${{ steps.meta.outputs.tags }} | ||
65 | labels: ${{ steps.meta.outputs.labels }} | ||
66 | |||
67 | - name: Image digest | ||
68 | run: echo ${{ steps.docker_build.outputs.digest }} | ||