-
Notifications
You must be signed in to change notification settings - Fork 11
52 lines (44 loc) · 1.72 KB
/
manual_ghcr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Manual Publish docker image to ghcr
on: workflow_dispatch
env:
GHCR_CONTAINER: ghcr.io/${{ github.repository }}
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get docker tag
run: echo "::set-output name=docker_tag::${GITHUB_REF##*/}_${{github.sha}}"
id: docker_tag
- name: Docker Login to ghcr
uses: docker/login-action@v1.12.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download latest earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Earthly version
run: earthly --version
- name: Run build and publish to ghcr
run: earthly --ci --push +publish --TAG=${{ steps.docker_tag.outputs.docker_tag }} --CONTAINER=${{ env.GHCR_CONTAINER }}
- name: Slack notification
if: always()
uses: 8398a7/action-slack@v3
with:
status: custom
fields: repo,workflow
custom_payload: |
{
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `Docker image creation ${{ job.status }}: ${{ env.GHCR_CONTAINER }}:${{ steps.docker_tag.outputs.docker_tag }}`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}