Do not deploy on docker hub for alpha #222
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
######################### | |
######################### | |
## Deploy Docker Image ## | |
######################### | |
######################### | |
# | |
# Documentation: | |
# https://help.github.com/en/articles/workflow-syntax-for-github-actions | |
# | |
####################################### | |
# Start the job on all push to main # | |
####################################### | |
name: "Build & Deploy - ALPHA" | |
on: | |
push: | |
branches: | |
- "alpha" | |
paths: | |
- ".github/workflows/**" | |
- "Dockerfile" | |
- "flavors/**" | |
- "megalinter/**" | |
- "mega-linter-runner/**" | |
- "server/**" | |
- "**/linter-versions.json" | |
- "TEMPLATES/**" | |
- ".trivyignore" | |
- "**/.sh" | |
############### | |
# Set the Job # | |
############### | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
# Name the Job | |
name: Deploy Docker Image - ALPHA | |
# Set the agent to run on | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
packages: write | |
# Only run this on the main repo | |
if: github.repository == 'oxsecurity/megalinter' && !contains(github.event.head_commit.message, 'skip deploy') | |
################## | |
# Load all steps # | |
################## | |
steps: | |
########################## | |
# Checkout the code base # | |
########################## | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
######################################################## | |
# Publish updated version of mega-linter-runner on NPM # | |
######################################################## | |
- uses: actions/[email protected] | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
- run: cd mega-linter-runner && yarn install --frozen-lockfile | |
- run: cd mega-linter-runner && ALPHAID=$(date '+%Y%m%d%H%M') && npm version prerelease --preid="alpha$ALPHAID" | |
shell: bash | |
# - run: cd mega-linter-runner && npm publish --tag alpha || echo "mega-linter-runner alpha not published" | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get current date | |
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV} | |
- name: Build & Push Docker Image (Server) | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: server/Dockerfile | |
platforms: linux/amd64 | |
build-args: | | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
BUILD_REVISION=${{ github.sha }} | |
BUILD_VERSION=alpha | |
load: false | |
push: true | |
secrets: | | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
tags: | | |
ghcr.io/oxsecurity/megalinter-server:alpha | |
# ghcr.io/oxsecurity/megalinter-server:alpha-${{ github.sha }} | |
- name: Build & Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64 | |
build-args: | | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
BUILD_REVISION=${{ github.sha }} | |
BUILD_VERSION=alpha | |
load: false | |
push: true | |
secrets: | | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
tags: | | |
ghcr.io/oxsecurity/megalinter:alpha | |
# ghcr.io/oxsecurity/megalinter:alpha-${{ github.sha }} | |
- name: Build & Push Worker Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile-worker | |
platforms: linux/amd64 | |
build-args: | | |
MEGALINTER_BASE_IMAGE=ghcr.io/oxsecurity/megalinter:alpha | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
BUILD_REVISION=${{ github.sha }} | |
BUILD_VERSION=alpha | |
load: false | |
push: true | |
secrets: | | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
tags: | | |
ghcr.io/oxsecurity/megalinter-worker:alpha |