blob: 73fe52c797b7975e9e8c907bb414b630875ba3a0 [file] [log] [blame]
Mohammed Naser1de55192023-04-28 17:13:35 -04001name: image
2
3on:
4 pull_request:
Mohammed Naser05d2af52024-01-01 21:11:26 -05005 paths-ignore:
6 - images/*/*/upper-constraints.txt
7 - go.mod
8 - go.sum
Mohammed Naser1de55192023-04-28 17:13:35 -04009 push:
10 branches:
11 - main
12 release:
13 types:
14 - published
15
Mohammed Naser55bbbf62023-04-28 22:24:55 +000016permissions:
17 packages: write
18 contents: read
19
Mohammed Naser1de55192023-04-28 17:13:35 -040020jobs:
21 build:
22 runs-on: ubuntu-latest
23 steps:
24 - name: Checkout project
dependabot[bot]804e8d22023-09-06 16:51:40 -040025 uses: actions/checkout@v4
Mohammed Naser1de55192023-04-28 17:13:35 -040026
27 - name: Install Earthly
28 uses: earthly/actions-setup@v1
29 with:
30 github-token: ${{ secrets.GITHUB_TOKEN }}
31
Mohammed Naser55bbbf62023-04-28 22:24:55 +000032 - name: Login to GitHub Container Registry
dependabot[bot]4040f2e2023-11-29 23:20:53 -050033 uses: docker/login-action@v3
Mohammed Naser5c1338a2023-04-28 21:37:57 +000034 with:
Mohammed Naser55bbbf62023-04-28 22:24:55 +000035 registry: ghcr.io
36 username: ${{ github.actor }}
37 password: ${{ secrets.GITHUB_TOKEN }}
Mohammed Naser5c1338a2023-04-28 21:37:57 +000038
Mohammed Naser1de55192023-04-28 17:13:35 -040039 - name: Build image
40 run: earthly +image --tag ${{ github.sha }}
41 env:
Mohammed Naser804d9122023-04-28 22:01:40 +000042 EARTHLY_CI: true
Mohammed Naser1de55192023-04-28 17:13:35 -040043 EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
Mohammed Naserccc70cc2023-04-28 22:20:34 +000044 EARTHLY_REMOTE_CACHE: ghcr.io/vexxhost/atmosphere:cache
Mohammed Naser1de55192023-04-28 17:13:35 -040045
46 publish:
47 runs-on: ubuntu-latest
48 if: github.event_name == 'release'
49 needs:
50 - build
51 steps:
Mohammed Naser55bbbf62023-04-28 22:24:55 +000052 - name: Login to GitHub Container Registry
dependabot[bot]4040f2e2023-11-29 23:20:53 -050053 uses: docker/login-action@v3
Mohammed Naser1de55192023-04-28 17:13:35 -040054 with:
Mohammed Naser55bbbf62023-04-28 22:24:55 +000055 registry: ghcr.io
56 username: ${{ github.actor }}
57 password: ${{ secrets.GITHUB_TOKEN }}
Mohammed Naser1de55192023-04-28 17:13:35 -040058
59 - name: Promote image
60 uses: akhilerm/tag-push-action@v2.1.0
61 with:
Mohammed Naserccc70cc2023-04-28 22:20:34 +000062 src: ghcr.io/vexxhost/atmosphere:${{ github.sha }}
63 dst: ghcr.io/vexxhost/atmosphere:${{ github.event.release.tag_name }}