Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 1 | name: image |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | push: |
| 6 | branches: |
| 7 | - main |
| 8 | release: |
| 9 | types: |
| 10 | - published |
| 11 | |
| 12 | jobs: |
| 13 | build: |
| 14 | runs-on: ubuntu-latest |
| 15 | steps: |
| 16 | - name: Checkout project |
| 17 | uses: actions/checkout@v3 |
| 18 | |
| 19 | - name: Install Earthly |
| 20 | uses: earthly/actions-setup@v1 |
| 21 | with: |
| 22 | github-token: ${{ secrets.GITHUB_TOKEN }} |
| 23 | |
Mohammed Naser | 5c1338a | 2023-04-28 21:37:57 +0000 | [diff] [blame] | 24 | - name: Authenticate to Quay.io |
| 25 | uses: docker/login-action@v2 |
| 26 | with: |
| 27 | registry: quay.io |
| 28 | username: ${{ secrets.QUAY_USERNAME }} |
| 29 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| 30 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 31 | - name: Build image |
| 32 | run: earthly +image --tag ${{ github.sha }} |
| 33 | env: |
| 34 | EARTHLY_PUSH: "${{ github.event_name == 'push' }}" |
| 35 | |
| 36 | publish: |
| 37 | runs-on: ubuntu-latest |
| 38 | if: github.event_name == 'release' |
| 39 | needs: |
| 40 | - build |
| 41 | steps: |
| 42 | - name: Authenticate to Quay.io |
| 43 | uses: docker/login-action@v2 |
| 44 | with: |
| 45 | registry: quay.io |
| 46 | username: ${{ secrets.QUAY_USERNAME }} |
| 47 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| 48 | |
| 49 | - name: Promote image |
| 50 | uses: akhilerm/tag-push-action@v2.1.0 |
| 51 | with: |
| 52 | src: quay.io/vexxhost/atmosphere:${{ github.sha }} |
| 53 | dst: quay.io/vexxhost/atmosphere:${{ github.event.release.tag_name }} |