|
1 | | -name: Build and Push to GHCR & Docker Hub |
| 1 | +name: Build and Push to Docker Hub |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [ main, master ] |
6 | 6 | tags: [ 'v*.*.*' ] |
7 | 7 | pull_request: |
8 | 8 | branches: [ main, master ] |
| 9 | + workflow_dispatch: |
9 | 10 |
|
10 | 11 | jobs: |
11 | 12 | build-and-push: |
12 | 13 | runs-on: ubuntu-latest |
13 | | - permissions: |
14 | | - contents: read |
15 | | - packages: write # Needed for GHCR |
16 | | - |
| 14 | + |
17 | 15 | steps: |
18 | 16 | - name: Checkout repository |
19 | 17 | uses: actions/checkout@v4 |
20 | | - |
| 18 | + |
21 | 19 | - name: Set up Docker Buildx |
22 | 20 | uses: docker/setup-buildx-action@v3 |
23 | | - |
24 | | - # Login to GHCR (using GITHUB_TOKEN) |
25 | | - - name: Login to GHCR |
26 | | - if: github.event_name != 'pull_request' |
27 | | - uses: docker/login-action@v3 |
28 | | - with: |
29 | | - registry: ghcr.io |
30 | | - username: ${{ github.actor }} |
31 | | - password: ${{ secrets.GITHUB_TOKEN }} |
32 | | - |
33 | | - # Login to Docker Hub (add your secrets first!) |
| 21 | + |
| 22 | + # Login to Docker Hub |
34 | 23 | - name: Login to Docker Hub |
35 | 24 | if: github.event_name != 'pull_request' |
36 | 25 | uses: docker/login-action@v3 |
37 | 26 | with: |
38 | | - username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 27 | + username: 1minds3t |
39 | 28 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
40 | | - |
41 | | - # Extract metadata/tags for BOTH registries |
| 29 | + |
| 30 | + # Extract metadata/tags |
42 | 31 | - name: Extract metadata (tags, labels) |
43 | 32 | id: meta |
44 | 33 | uses: docker/metadata-action@v5 |
45 | 34 | with: |
46 | | - images: | |
47 | | - ghcr.io/${{ github.repository }} |
48 | | - 1minds3t/omnipkg # Your Docker Hub repo |
| 35 | + images: 1minds3t/omnipkg |
49 | 36 | tags: | |
50 | 37 | type=ref,event=branch |
51 | 38 | type=ref,event=pr |
52 | 39 | type=semver,pattern={{version}} |
| 40 | + type=semver,pattern={{major}}.{{minor}} |
| 41 | + type=raw,value=latest,enable={{is_default_branch}} |
53 | 42 | type=sha |
54 | | -
|
55 | | - # Build and push to both |
56 | | - - name: Build and push |
57 | | - uses: docker/build-push-action@v6 |
| 43 | + |
| 44 | + # Build and push |
| 45 | + - name: Build and push to Docker Hub |
| 46 | + uses: docker/build-push-action@v5 |
58 | 47 | with: |
59 | 48 | context: . |
| 49 | + platforms: linux/amd64,linux/arm64 |
60 | 50 | push: ${{ github.event_name != 'pull_request' }} |
61 | 51 | tags: ${{ steps.meta.outputs.tags }} |
62 | 52 | labels: ${{ steps.meta.outputs.labels }} |
|
0 commit comments