-
-
Notifications
You must be signed in to change notification settings - Fork 63
97 lines (85 loc) · 2.61 KB
/
deploy-RELEASE.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#######################################
# Start the job on all push to master #
#######################################
name: 'Build & Deploy - RELEASE'
on:
release:
# Want to run the automation when a release is created
types: ['created']
permissions: read-all
concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true
###############
# Set the Job #
###############
jobs:
deploy_to_npm:
name: Deploy to NPM (release)
runs-on: ubuntu-latest
permissions: read-all
environment:
name: release
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4.0.3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
scope: nvuillam
- run: npm ci
- run: |
git config --global user.name nvuillam
git config --global user.email nicolas.vuillamy@gmail.com
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Build & push docker image (release)
build_push_docker:
name: Build & Push Docker image (release)
needs: deploy_to_npm
runs-on: ubuntu-latest
permissions: read-all
environment:
name: release
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build & push docker image (beta)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get current date
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV}
- 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=${{ github.event.release.tag_name }}
NPM_GROOVY_LINT_VERSION=latest
load: false
push: true
tags: |
nvuillam/npm-groovy-lint:${{ github.event.release.tag_name }}
nvuillam/npm-groovy-lint:latest