Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 1 | name: image |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
Mohammed Naser | 05d2af5 | 2024-01-01 21:11:26 -0500 | [diff] [blame] | 5 | paths-ignore: |
| 6 | - images/*/*/upper-constraints.txt |
| 7 | - go.mod |
| 8 | - go.sum |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 9 | push: |
| 10 | branches: |
| 11 | - main |
| 12 | release: |
| 13 | types: |
| 14 | - published |
| 15 | |
Mohammed Naser | 55bbbf6 | 2023-04-28 22:24:55 +0000 | [diff] [blame] | 16 | permissions: |
| 17 | packages: write |
| 18 | contents: read |
| 19 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 20 | jobs: |
| 21 | build: |
| 22 | runs-on: ubuntu-latest |
| 23 | steps: |
| 24 | - name: Checkout project |
dependabot[bot] | 804e8d2 | 2023-09-06 16:51:40 -0400 | [diff] [blame] | 25 | uses: actions/checkout@v4 |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 26 | |
| 27 | - name: Install Earthly |
| 28 | uses: earthly/actions-setup@v1 |
| 29 | with: |
| 30 | github-token: ${{ secrets.GITHUB_TOKEN }} |
| 31 | |
Mohammed Naser | 55bbbf6 | 2023-04-28 22:24:55 +0000 | [diff] [blame] | 32 | - name: Login to GitHub Container Registry |
dependabot[bot] | 4040f2e | 2023-11-29 23:20:53 -0500 | [diff] [blame] | 33 | uses: docker/login-action@v3 |
Mohammed Naser | 5c1338a | 2023-04-28 21:37:57 +0000 | [diff] [blame] | 34 | with: |
Mohammed Naser | 55bbbf6 | 2023-04-28 22:24:55 +0000 | [diff] [blame] | 35 | registry: ghcr.io |
| 36 | username: ${{ github.actor }} |
| 37 | password: ${{ secrets.GITHUB_TOKEN }} |
Mohammed Naser | 5c1338a | 2023-04-28 21:37:57 +0000 | [diff] [blame] | 38 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 39 | - name: Build image |
| 40 | run: earthly +image --tag ${{ github.sha }} |
| 41 | env: |
Mohammed Naser | 804d912 | 2023-04-28 22:01:40 +0000 | [diff] [blame] | 42 | EARTHLY_CI: true |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 43 | EARTHLY_PUSH: "${{ github.event_name == 'push' }}" |
Mohammed Naser | ccc70cc | 2023-04-28 22:20:34 +0000 | [diff] [blame] | 44 | EARTHLY_REMOTE_CACHE: ghcr.io/vexxhost/atmosphere:cache |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 45 | |
| 46 | publish: |
| 47 | runs-on: ubuntu-latest |
| 48 | if: github.event_name == 'release' |
| 49 | needs: |
| 50 | - build |
| 51 | steps: |
Mohammed Naser | 55bbbf6 | 2023-04-28 22:24:55 +0000 | [diff] [blame] | 52 | - name: Login to GitHub Container Registry |
dependabot[bot] | 4040f2e | 2023-11-29 23:20:53 -0500 | [diff] [blame] | 53 | uses: docker/login-action@v3 |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 54 | with: |
Mohammed Naser | 55bbbf6 | 2023-04-28 22:24:55 +0000 | [diff] [blame] | 55 | registry: ghcr.io |
| 56 | username: ${{ github.actor }} |
| 57 | password: ${{ secrets.GITHUB_TOKEN }} |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 58 | |
| 59 | - name: Promote image |
| 60 | uses: akhilerm/tag-push-action@v2.1.0 |
| 61 | with: |
Mohammed Naser | ccc70cc | 2023-04-28 22:20:34 +0000 | [diff] [blame] | 62 | src: ghcr.io/vexxhost/atmosphere:${{ github.sha }} |
| 63 | dst: ghcr.io/vexxhost/atmosphere:${{ github.event.release.tag_name }} |