|
5 | 5 | workflows: ["Release Build"] |
6 | 6 | types: |
7 | 7 | - completed |
| 8 | + |
8 | 9 | env: |
9 | | - REGISTRY_IMAGE: quay.io/redlib/redlib |
| 10 | + REGISTRY_IMAGE: ghcr.io/algorithm5838/redlib |
10 | 11 |
|
11 | 12 | jobs: |
12 | 13 | build: |
13 | 14 | runs-on: ubuntu-latest |
14 | | - strategy: |
15 | | - fail-fast: false |
16 | | - matrix: |
17 | | - include: |
18 | | - - { platform: linux/amd64, target: x86_64-unknown-linux-musl } |
19 | | - - { platform: linux/arm64, target: aarch64-unknown-linux-musl } |
20 | | - - { platform: linux/arm/v7, target: armv7-unknown-linux-musleabihf } |
| 15 | + # Only build if the Release Build succeeded |
| 16 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
21 | 17 | steps: |
22 | 18 | - name: Checkout |
23 | 19 | uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Download binary artifact from Release Build |
| 22 | + uses: actions/download-artifact@v4 |
| 23 | + with: |
| 24 | + name: redlib-aarch64-unknown-linux-musl |
| 25 | + path: docker-bin/ |
| 26 | + run-id: ${{ github.event.workflow_run.id }} |
| 27 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + |
| 29 | + - name: Make binary executable |
| 30 | + run: chmod +x docker-bin/redlib |
| 31 | + |
24 | 32 | - name: Docker meta |
25 | 33 | id: meta |
26 | 34 | uses: docker/metadata-action@v5 |
27 | 35 | with: |
28 | 36 | images: ${{ env.REGISTRY_IMAGE }} |
29 | 37 | tags: | |
30 | | - type=sha |
| 38 | + type=sha,prefix=sha-,format=short,event=branch |
31 | 39 | type=raw,value=latest,enable={{is_default_branch}} |
32 | | - - name: Set up QEMU |
33 | | - uses: docker/setup-qemu-action@v3 |
| 40 | +
|
34 | 41 | - name: Set up Docker Buildx |
35 | 42 | uses: docker/setup-buildx-action@v3 |
36 | | - - name: Login to Quay.io Container Registry |
| 43 | + |
| 44 | + - name: Login to GitHub Container Registry |
37 | 45 | uses: docker/login-action@v3 |
38 | 46 | with: |
39 | | - registry: quay.io |
40 | | - username: ${{ secrets.QUAY_USERNAME }} |
41 | | - password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
42 | | - - name: Build and push |
43 | | - id: build |
| 47 | + registry: ghcr.io |
| 48 | + username: ${{ github.actor }} |
| 49 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + |
| 51 | + - name: Build and push (ARM64) |
44 | 52 | uses: docker/build-push-action@v5 |
45 | 53 | with: |
46 | 54 | context: . |
47 | | - platforms: ${{ matrix.platform }} |
| 55 | + platforms: linux/arm64 |
| 56 | + push: true |
| 57 | + tags: ${{ steps.meta.outputs.tags }} |
48 | 58 | labels: ${{ steps.meta.outputs.labels }} |
49 | | - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true |
50 | | - file: Dockerfile |
51 | | - build-args: TARGET=${{ matrix.target }} |
52 | | - - name: Export digest |
53 | | - run: | |
54 | | - mkdir -p /tmp/digests |
55 | | - digest="${{ steps.build.outputs.digest }}" |
56 | | - touch "/tmp/digests/${digest#sha256:}" |
57 | | - - name: Upload digest |
58 | | - uses: actions/upload-artifact@v4 |
59 | | - with: |
60 | | - name: digests-${{ matrix.target }} |
61 | | - path: /tmp/digests/* |
62 | | - if-no-files-found: error |
63 | | - retention-days: 1 |
64 | | - merge: |
65 | | - runs-on: ubuntu-latest |
66 | | - needs: |
67 | | - - build |
68 | | - steps: |
69 | | - - name: Download digests |
70 | | - uses: actions/download-artifact@v4.1.7 |
71 | | - with: |
72 | | - path: /tmp/digests |
73 | | - pattern: digests-* |
74 | | - merge-multiple: true |
75 | | - |
76 | | - - name: Set up Docker Buildx |
77 | | - uses: docker/setup-buildx-action@v3 |
78 | | - - name: Docker meta |
79 | | - id: meta |
80 | | - uses: docker/metadata-action@v5 |
81 | | - with: |
82 | | - images: ${{ env.REGISTRY_IMAGE }} |
83 | | - tags: | |
84 | | - type=sha |
85 | | - type=raw,value=latest,enable={{is_default_branch}} |
86 | | - - name: Login to Quay.io Container Registry |
87 | | - uses: docker/login-action@v3 |
88 | | - with: |
89 | | - registry: quay.io |
90 | | - username: ${{ secrets.QUAY_USERNAME }} |
91 | | - password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
92 | | - - name: Create manifest list and push |
93 | | - working-directory: /tmp/digests |
94 | | - run: | |
95 | | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
96 | | - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) |
97 | | -
|
98 | | - # - name: Push README to Quay.io |
99 | | - # uses: christian-korneck/update-container-description-action@v1 |
100 | | - # env: |
101 | | - # DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }} |
102 | | - # with: |
103 | | - # destination_container_repo: quay.io/redlib/redlib |
104 | | - # provider: quay |
105 | | - # readme_file: 'README.md' |
| 59 | + file: Dockerfile.prebuilt |
106 | 60 |
|
107 | | - - name: Inspect image |
| 61 | + - name: Print image tags |
108 | 62 | run: | |
109 | | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} |
| 63 | + echo "## Docker Image" >> $GITHUB_STEP_SUMMARY |
| 64 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 65 | + echo "docker pull ${{ env.REGISTRY_IMAGE }}:latest" >> $GITHUB_STEP_SUMMARY |
| 66 | + echo "docker pull ${{ env.REGISTRY_IMAGE }}:sha-$(echo '${{ github.event.workflow_run.head_sha }}' | cut -c1-7)" >> $GITHUB_STEP_SUMMARY |
| 67 | + echo '```' >> $GITHUB_STEP_SUMMARY |
0 commit comments