-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (56 loc) · 1.87 KB
/
docker-publish.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Docker Publish to GitHub
on:
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_ID: "ghcr.io/${{ github.repository_owner }}/glassfish"
IMAGE_VERSION: 7.0.16
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Maven Configure
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
platforms: linux/amd64,linux/arm64
- name: Build
run: mvn clean prepare-package -Dglassfish.version=$IMAGE_VERSION
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Additional Info
run: |
mvn -v
uname -a
docker buildx ls
docker buildx imagetools inspect ${{ env.IMAGE_ID }}:latest
- name: Undeploy Existing Package
uses: actions/delete-package-versions@v5
with:
owner: ${{ github.repository_owner }}
package-type: container
package-name: glassfish
package-version-ids: ${{ env.IMAGE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Deploy
uses: docker/build-push-action@v6
with:
context: ${{ env.IMAGE_VERSION }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.IMAGE_VERSION }},${{ env.IMAGE_ID }}:latest