|
24 | 24 | IS_PRERELEASE: ${{ github.event.release.prerelease || github.event.inputs.PRERELEASE }} |
25 | 25 |
|
26 | 26 | jobs: |
27 | | -# =============================================================== |
28 | | -# Building Dev Images |
29 | | -# =============================================================== |
| 27 | + # This workaround is needed, as it's not possible to reference env.FOOBAR directly at this stage |
| 28 | + # - for ex. https://github.com/actions/runner/issues/1189 |
| 29 | + release-container-prereq: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + outputs: |
| 32 | + tag: ${{ steps.set-output-defaults.outputs.tag }} |
| 33 | + tag_latest: ${{ steps.set-output-defaults.outputs.tag_latest }} |
| 34 | + steps: |
| 35 | + - id: set-output-defaults |
| 36 | + run: | |
| 37 | + echo "::set-output name=tag::${{ env.IS_PRERELEASE == 'true' && 'alpha' || 'ubuntu' }}" |
| 38 | + echo "::set-output name=tag_latest::${{ env.IS_PRERELEASE == 'true' && 'false' || 'true' }}" |
| 39 | +
|
| 40 | + release-container: |
| 41 | + needs: release-container-prereq |
| 42 | + uses: ./.github/workflows/reusable-container-workflow.yaml |
| 43 | + with: |
| 44 | + dockerfile: tools/docker/Dockerfile.ubuntu-prod |
| 45 | + tag: ${{ needs.release-container-prereq.outputs.tag }} |
| 46 | + tag_latest: ${{ needs.release-container-prereq.outputs.tag_latest == 'true' }} |
| 47 | + image: ghcr.io/${{ github.repository }} |
| 48 | + registry: ghcr.io |
| 49 | + registry_username: ${{ github.repository_owner }} |
| 50 | + fetch_release: true |
| 51 | + release_version: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} |
| 52 | + secrets: |
| 53 | + registry_password: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + |
30 | 56 | release: |
| 57 | + needs: [release-container-prereq, release-container] |
31 | 58 | runs-on: ubuntu-latest |
32 | 59 | steps: |
33 | 60 | - name: print_env |
|
41 | 68 | - name: Install helm |
42 | 69 | uses: azure/setup-helm@v3 |
43 | 70 |
|
44 | | - - uses: dsaltares/fetch-gh-release-asset@master |
45 | | - with: |
46 | | - version: 'tags/${{ env.TAG_NAME }}' |
47 | | - regex: true |
48 | | - file: "dragonfly-.*\\.tar\\.gz" |
49 | | - target: 'releases/' |
50 | | - token: ${{ secrets.GITHUB_TOKEN }} |
51 | | - |
52 | | - - name: Set up QEMU |
53 | | - id: qemu |
54 | | - uses: docker/setup-qemu-action@v1 |
55 | | - with: |
56 | | - platforms: arm64,amd64 |
57 | | - |
58 | | - - name: Set up Docker Buildx |
59 | | - uses: docker/setup-buildx-action@v1 |
60 | | - |
61 | | - - name: Login to GitHub Container Registry |
62 | | - uses: docker/login-action@v2 |
63 | | - with: |
64 | | - registry: ghcr.io |
65 | | - username: ${{ github.actor }} |
66 | | - password: ${{ secrets.GITHUB_TOKEN }} |
67 | | - |
68 | | - - name: Extract artifacts |
69 | | - run: | |
70 | | - echo "Event prerelease ${{ github.event.release.prerelease }}" |
71 | | - echo "Input prerelease ${{ github.event.inputs.PRERELEASE }}" |
72 | | - ls -l |
73 | | - ls -l releases |
74 | | - for f in releases/*.tar.gz; do tar xvfz $f -C releases; done |
75 | | - rm releases/*.tar.gz |
76 | | -
|
77 | | - - name: Build release image |
78 | | - if: env.IS_PRERELEASE != 'true' |
79 | | - uses: docker/build-push-action@v3 |
80 | | - with: |
81 | | - context: . |
82 | | - platforms: linux/amd64,linux/arm64 |
83 | | - |
84 | | - # Define QEMU settings inside the builder |
85 | | - build-args: | |
86 | | - QEMU_CPU=max,pauth-impdef=on |
87 | | -
|
88 | | - push: ${{ github.event_name != 'pull_request' }} |
89 | | - tags: | |
90 | | - ghcr.io/${{ github.repository }}:ubuntu |
91 | | - ghcr.io/${{ github.repository }}:latest |
92 | | - ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }} |
93 | | - ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }}-ubuntu |
94 | | -
|
95 | | - file: tools/docker/Dockerfile.ubuntu-prod |
96 | | - cache-from: type=registry,ref=${{ github.repository }}:latest |
97 | | - cache-to: type=inline |
98 | | - |
99 | | - - name: Build pre-release image |
100 | | - if: env.IS_PRERELEASE == 'true' |
101 | | - uses: docker/build-push-action@v3 |
102 | | - with: |
103 | | - context: . |
104 | | - platforms: linux/amd64,linux/arm64 |
105 | | - |
106 | | - push: ${{ github.event_name != 'pull_request' }} |
107 | | - tags: | |
108 | | - ghcr.io/${{ github.repository }}:alpha |
109 | | - ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }} |
110 | | - file: tools/docker/Dockerfile.ubuntu-prod |
111 | | - cache-from: type=registry,ref=${{ github.repository }}:latest |
112 | | - cache-to: type=inline |
113 | | - |
114 | 71 | - name: Configure Git |
115 | 72 | if: env.IS_PRERELEASE != 'true' |
116 | 73 | run: | |
|
0 commit comments