11---
2- # ########################
3- # ########################
4- # # Deploy Docker Image ##
5- # ########################
6- # ########################
72
8- #
9- # Documentation:
10- # https://help.github.com/en/articles/workflow-syntax-for-github-actions
11- #
12-
13- # ######################################
14- # Start the job on all push to main #
15- # ######################################
163name : " Build & Deploy - RELEASE"
174on :
18- release :
19- # Want to run the automation when a release is created
20- types : ["created"]
21- paths :
22- - " Dockerfile"
23- - " megalinter/**"
24- - " mega-linter-runner/**"
25- - " flavors/**"
26- - " **/linter-versions.json"
27- - " **/.sh"
5+ push :
6+ branches :
7+ - fix-doc
288
299# ##############
3010# Set the Job #
3111# ##############
3212jobs :
33- build :
34- # Name the Job
35- name : Deploy Docker Image - RELEASE
36- # Set the agent to run on
37- runs-on : ubuntu-latest
38- # Only run on main repo
39- if : github.repository == 'oxsecurity/megalinter' && !contains(github.event.head_commit.message, 'skip deploy')
40- permissions :
41- actions : write
42- packages : write
43- environment :
44- name : release
45- # #################
46- # Load all steps #
47- # #################
48- steps :
49- # #########################
50- # Checkout the code base #
51- # #########################
52- - name : Checkout Code
53- uses : actions/checkout@v6
54-
55- # #######################################################
56- # Publish updated version of mega-linter-runner on NPM #
57- # #######################################################
58- - uses : actions/setup-node@v6.1.0
59- with :
60- node-version : " 24.x"
61- registry-url : " https://registry.npmjs.org"
62- - run : cd mega-linter-runner && npm install
63- - run : cd mega-linter-runner && npm publish || echo "mega-linter-runner not published"
64- env :
65- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
66-
67- - name : Login to GitHub Container Registry
68- uses : docker/login-action@v3
69- with :
70- registry : ghcr.io
71- username : ${{ github.repository_owner }}
72- password : ${{ secrets.GITHUB_TOKEN }}
73-
74- # Free disk space
75- - name : Free Disk space
76- shell : bash
77- run : |
78- sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
79- sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
80- sudo rm -rf /opt/ghc
81- sudo rm -rf "$AGENT_TOOLSDIRECTORY"
82-
83- - name : Get current date
84- run : echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV}
85-
86- - name : Build Image
87- uses : docker/build-push-action@v6
88- with :
89- context : .
90- file : Dockerfile-release
91- platforms : linux/amd64
92- build-args : |
93- MEGALINTER_BASE_IMAGE=docker.io/oxsecurity/megalinter:beta
94- BUILD_DATE=${{ env.BUILD_DATE }}
95- BUILD_REVISION=${{ github.sha }}
96- BUILD_VERSION=${{ github.event.release.tag_name }}
97- load : false
98- push : true
99- secrets : |
100- GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
101- # MAJOR-RELEASE-IMPACTED
102- tags : |
103- ghcr.io/oxsecurity/megalinter:v9
104- ghcr.io/oxsecurity/megalinter:${{ github.event.release.tag_name }}
105- ghcr.io/oxsecurity/megalinter:latest
106-
107- - name : Invoke Mirror docker image workflow (Main image)
108- uses : benc-uk/workflow-dispatch@v1
109- with :
110- workflow : mirror-docker-image.yml
111- # MAJOR-RELEASE-IMPACTED
112- inputs : ' { "source-image": "ghcr.io/oxsecurity/megalinter:v9", "target-image": "docker.io/oxsecurity/megalinter:v9" }'
113- ref : main
114- - name : Invoke Mirror docker image workflow (Main image)
115- uses : benc-uk/workflow-dispatch@v1
116- with :
117- workflow : mirror-docker-image.yml
118- # MAJOR-RELEASE-IMPACTED
119- inputs : ' { "source-image": "ghcr.io/oxsecurity/megalinter:v9", "target-image": "docker.io/oxsecurity/megalinter:${{ github.event.release.tag_name }}" }'
120- ref : main
121- - name : Invoke Mirror docker image workflow (Main image)
122- uses : benc-uk/workflow-dispatch@v1
123- with :
124- workflow : mirror-docker-image.yml
125- # MAJOR-RELEASE-IMPACTED
126- inputs : ' { "source-image": "ghcr.io/oxsecurity/megalinter:v9", "target-image": "docker.io/oxsecurity/megalinter:latest" }'
127- ref : main
128-
129- - name : Build Flavor Builder Image
130- uses : docker/build-push-action@v6
131- with :
132- context : .
133- file : Dockerfile-custom-flavor
134- platforms : linux/amd64
135- build-args : |
136- BUILD_DATE=${{ env.BUILD_DATE }}
137- BUILD_REVISION=${{ github.sha }}
138- BUILD_VERSION=${{ github.event.release.tag_name }}
139- load : false
140- push : true
141- secrets : |
142- GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
143- # MAJOR-RELEASE-IMPACTED
144- tags : |
145- ghcr.io/oxsecurity/megalinter-custom-flavor-builder:v9
146- ghcr.io/oxsecurity/megalinter-custom-flavor-builder:${{ github.event.release.tag_name }}
147- ghcr.io/oxsecurity/megalinter-custom-flavor-builder:latest
148-
149- # - name: Build Worker Image
150- # uses: docker/build-push-action@v6
151- # with:
152- # context: .
153- # file: Dockerfile-release
154- # platforms: linux/amd64
155- # build-args: |
156- # MEGALINTER_BASE_IMAGE=docker.io/oxsecurity/megalinter-worker:beta
157- # BUILD_DATE=${{ env.BUILD_DATE }}
158- # BUILD_REVISION=${{ github.sha }}
159- # BUILD_VERSION=${{ github.event.release.tag_name }}
160- # load: false
161- # push: true
162- # secrets: |
163- # GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
164- # tags: |
165- # ghcr.io/oxsecurity/megalinter-worker:v9
166- # ghcr.io/oxsecurity/megalinter-worker:${{ github.event.release.tag_name }}
167- # ghcr.io/oxsecurity/megalinter-worker:latest
168-
169- # - name: Invoke Mirror docker image workflow (Worker image)
170- # uses: benc-uk/workflow-dispatch@v1
171- # with:
172- # workflow: mirror-docker-image.yml
173- # inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker:v9", "target-image": "docker.io/oxsecurity/megalinter-worker:v9" }'
174- # - name: Invoke Mirror docker image workflow (Worker image)
175- # uses: benc-uk/workflow-dispatch@v1
176- # with:
177- # workflow: mirror-docker-image.yml
178- # inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker:v9", "target-image": "docker.io/oxsecurity/megalinter-worker:${{ github.event.release.tag_name }}" }'
179- # - name: Invoke Mirror docker image workflow (Worker image)
180- # uses: benc-uk/workflow-dispatch@v1
181- # with:
182- # workflow: mirror-docker-image.yml
183- # inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker:v9", "target-image": "docker.io/oxsecurity/megalinter-worker:latest" }'
18413
18514 deploy_doc :
18615 runs-on : ubuntu-latest
@@ -198,11 +27,11 @@ jobs:
19827 id : version
19928 run : |
20029 {
201- echo "cversion=$(git describe --tags --match='v*' --abbrev=0 | cut -c2-) "
202- echo "ctag=$(git describe --tags --match='v*' --abbrev=0) "
203- echo "pversion=$(git describe --abbrev=0 --match='v*' --tags "$(git rev-list --tags --skip=1 --max-count=1)" | cut -c2-) "
204- echo "ptag=$(git describe --abbrev=0 --match='v*' --tags "$(git rev-list --tags --skip=1 --max-count=1)") "
205- } >>"$GITHUB_OUTPUT"
30+ echo "cversion=9.3.0 "
31+ echo "ctag=v9.3.0 "
32+ echo "pversion=9.2.0 "
33+ echo "ptag=v9.2.0 "
34+ } >>"$GITHUB_OUTPUT"
20635 - name : Print tags
20736 run : |
20837 echo "prev tag ${{ steps.version.outputs.ptag }}"
0 commit comments