|
8 | 8 | jobs: |
9 | 9 | publish: |
10 | 10 | runs-on: ubuntu-latest |
| 11 | + |
11 | 12 | steps: |
| 13 | + |
12 | 14 | - uses: actions/checkout@master |
13 | 15 | - name: Install Go |
14 | 16 | uses: actions/setup-go@master |
15 | 17 | with: |
16 | | - go-version: "1.23.x" |
| 18 | + go-version: 1.23.x |
17 | 19 | - name: Set up QEMU |
18 | 20 | uses: docker/setup-qemu-action@v3 |
| 21 | + |
19 | 22 | - name: Set up Docker Buildx |
20 | 23 | uses: docker/setup-buildx-action@v3 |
| 24 | + |
21 | 25 | - name: Get TAG |
22 | 26 | id: get_tag |
23 | | - run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} |
24 | | - - name: Set up Docker Buildx |
25 | | - uses: docker/setup-buildx-action@v3 |
| 27 | + run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV |
| 28 | + |
| 29 | + - name: Get git commit |
| 30 | + id: get_git_commit |
| 31 | + run: echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV |
| 32 | + - name: Get version |
| 33 | + id: get_version |
| 34 | + run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV |
| 35 | + - name: Get Repo Owner |
| 36 | + id: get_repo_owner |
| 37 | + run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV |
| 38 | + |
26 | 39 | - name: Login to Docker Registry |
27 | 40 | uses: docker/login-action@v3 |
28 | 41 | with: |
29 | | - username: ${{ secrets.DOCKER_USERNAME }} |
30 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
| 42 | + username: ${{ github.repository_owner }} |
| 43 | + password: ${{ secrets.GITHUB_TOKEN }} |
31 | 44 | registry: ghcr.io |
| 45 | + |
32 | 46 | - name: Push containers |
33 | 47 | uses: docker/build-push-action@v6 |
34 | 48 | with: |
35 | 49 | context: . |
36 | 50 | file: ./Dockerfile |
37 | 51 | outputs: "type=registry,push=true" |
38 | 52 | platforms: linux/amd64,linux/arm64 |
| 53 | + build-args: | |
| 54 | + GIT_COMMIT=${{env.GIT_COMMIT}} |
| 55 | + VERSION=${{env.VERSION}} |
39 | 56 | tags: | |
40 | | - ghcr.io/openfaas/cron-connector:${{ github.sha }} |
41 | | - ghcr.io/openfaas/cron-connector:${{ steps.get_tag.outputs.TAG }} |
42 | | - ghcr.io/openfaas/cron-connector:latest |
| 57 | + ghcr.io/${{ env.REPO_OWNER }}/cron-connector:${{ github.sha }} |
| 58 | + ghcr.io/${{ env.REPO_OWNER }}/cron-connector:${{ env.TAG }} |
| 59 | + ghcr.io/${{ env.REPO_OWNER }}/cron-connector:latest |
0 commit comments