| name: image |
| |
| on: |
| pull_request: |
| paths-ignore: |
| - images/** |
| - go.mod |
| - go.sum |
| push: |
| branches: |
| - main |
| release: |
| types: |
| - published |
| |
| permissions: |
| packages: write |
| contents: read |
| |
| jobs: |
| build: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout project |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| |
| - name: Install Earthly |
| uses: earthly/actions-setup@v1 |
| with: |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| |
| - name: Login to GitHub Container Registry |
| uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3 |
| with: |
| registry: ghcr.io |
| username: ${{ github.actor }} |
| password: ${{ secrets.GITHUB_TOKEN }} |
| |
| - name: Build image |
| run: earthly +image --tag ${{ github.sha }} |
| env: |
| EARTHLY_CI: true |
| EARTHLY_PUSH: "${{ github.event_name == 'push' }}" |
| EARTHLY_REMOTE_CACHE: ghcr.io/vexxhost/atmosphere:cache |
| |
| publish: |
| runs-on: ubuntu-latest |
| if: github.event_name == 'release' |
| needs: |
| - build |
| steps: |
| - name: Login to GitHub Container Registry |
| uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3 |
| with: |
| registry: ghcr.io |
| username: ${{ github.actor }} |
| password: ${{ secrets.GITHUB_TOKEN }} |
| |
| - name: Promote image |
| uses: akhilerm/tag-push-action@85bf542f43f5f2060ef76262a67ee3607cb6db37 # v2.1.0 |
| with: |
| src: ghcr.io/vexxhost/atmosphere:${{ github.sha }} |
| dst: ghcr.io/vexxhost/atmosphere:${{ github.event.release.tag_name }} |