|
8 | 8 |
|
9 | 9 | jobs:
|
10 | 10 | buildx:
|
| 11 | + name: Build Docker Image |
11 | 12 | runs-on: ubuntu-latest
|
12 | 13 | steps:
|
13 | 14 | - name: Checkout
|
14 | 15 | uses: actions/checkout@v4
|
15 | 16 |
|
| 17 | + - name: Check pushing to Docker Hub |
| 18 | + id: push-other-places |
| 19 | + # Only push to Dockerhub from the main repo |
| 20 | + # Otherwise forks would require a Docker Hub account and secrets setup |
| 21 | + run: | |
| 22 | + if [[ ${{ github.repository_owner }} == "caronc" ]] ; then |
| 23 | + echo "Enabling DockerHub image push" |
| 24 | + echo "enable=true" >> $GITHUB_OUTPUT |
| 25 | + else |
| 26 | + echo "Not pushing to DockerHub" |
| 27 | + echo "enable=false" >> $GITHUB_OUTPUT |
| 28 | + fi |
| 29 | +
|
| 30 | + # Mostly for forks, set an output package name for ghcr.io using the repo name |
| 31 | + - name: Set ghcr repository name |
| 32 | + id: set-ghcr-repository |
| 33 | + run: | |
| 34 | + ghcr_name=$(echo "${{ github.repository_owner }}/apprise" | awk '{ print tolower($0) }') |
| 35 | + echo "Name is ${ghcr_name}" |
| 36 | + echo "ghcr-repository=${ghcr_name}" >> $GITHUB_OUTPUT |
| 37 | +
|
16 | 38 | - name: Docker meta
|
17 | 39 | id: docker_meta
|
18 | 40 | uses: docker/metadata-action@v5
|
19 | 41 | with:
|
20 | 42 | images: |
|
21 |
| - docker.io/caronc/apprise |
| 43 | + ghcr.io/${{ steps.set-ghcr-repository.outputs.ghcr-repository }} |
| 44 | + name=docker.io/caronc/apprise,enable=${{ steps.push-other-places.outputs.enable }} |
22 | 45 | tags: |
|
23 | 46 | type=semver,event=tag,pattern={{version}}
|
24 | 47 | type=semver,event=tag,pattern={{major}}.{{minor}}
|
|
30 | 53 | - name: Set up Docker Buildx
|
31 | 54 | uses: docker/setup-buildx-action@v3
|
32 | 55 |
|
33 |
| - - name: Check pushing to Docker Hub |
34 |
| - id: push-other-places |
35 |
| - # Only push to Dockerhub from the main repo |
36 |
| - # Otherwise forks would require a Docker Hub account and secrets setup |
37 |
| - run: | |
38 |
| - if [[ ${{ github.repository_owner }} == "caronc" ]] ; then |
39 |
| - echo "Enabling DockerHub image push" |
40 |
| - echo "enable=true" >> $GITHUB_OUTPUT |
41 |
| - else |
42 |
| - echo "Not pushing to DockerHub" |
43 |
| - echo "enable=false" >> $GITHUB_OUTPUT |
44 |
| - fi |
45 |
| -
|
46 | 56 | - name: Login to DockerHub
|
47 | 57 | uses: docker/login-action@v3
|
48 | 58 | # Don't attempt to login is not pushing to Docker Hub
|
|
51 | 61 | username: ${{ secrets.DOCKER_USERNAME }}
|
52 | 62 | password: ${{ secrets.DOCKER_PASSWORD }}
|
53 | 63 |
|
| 64 | + - name: Login to GitHub Container Registry |
| 65 | + uses: docker/login-action@v3 |
| 66 | + with: |
| 67 | + registry: ghcr.io |
| 68 | + username: ${{ github.actor }} |
| 69 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + |
54 | 71 | - name: Build and push
|
55 | 72 | uses: docker/build-push-action@v6
|
56 | 73 | with:
|
|
0 commit comments