fix(ci): update node-version from 18 to 20 (#307) #201
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
--- | |
name: Release | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
- '.github/dependabot.yml' | |
schedule: | |
# every Saturday | |
- cron: '0 0 * * 6' | |
workflow_dispatch: | |
env: | |
DOCKER_IMAGE_NAME: gofrolist/molecule | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Docker meta | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.DOCKER_IMAGE_NAME }} | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}} | |
type=ref,event=branch | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: Dockerfile | |
load: true | |
tags: ${{ env.DOCKER_IMAGE_NAME }}:test | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=/tmp/test.tar | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: testimage | |
path: /tmp/test.tar | |
molecule: | |
needs: | |
- build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download artifact | |
uses: actions/[email protected] | |
with: | |
name: testimage | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/test.tar | |
docker image ls -a | |
- name: Test run Molecule | |
run: | | |
docker run --rm ${{ env.DOCKER_IMAGE_NAME }}:test molecule --version | |
snyk-docker: | |
needs: | |
- build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Download artifact | |
uses: actions/[email protected] | |
with: | |
name: testimage | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/test.tar | |
docker image ls -a | |
- name: Run Snyk to check Docker image for vulnerabilities | |
continue-on-error: true | |
uses: snyk/actions/docker@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
image: ${{ env.DOCKER_IMAGE_NAME }}:test | |
sarif: true | |
args: --file=Dockerfile --exclude-app-vulns | |
- name: Upload result to GitHub Code Scanning | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: snyk.sarif | |
snyk-python: | |
needs: | |
- build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Run Snyk to check for Python vulnerabilities | |
continue-on-error: true | |
uses: snyk/actions/python@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
args: --sarif-file-output=snyk-python.sarif | |
- name: Upload result to GitHub Code Scanning | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: snyk-python.sarif | |
release: | |
needs: | |
- build | |
- molecule | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '20' | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: npx semantic-release -p @semantic-release/commit-analyzer -p @semantic-release/release-notes-generator -p @semantic-release/github |