-
Notifications
You must be signed in to change notification settings - Fork 15
152 lines (151 loc) · 5.29 KB
/
node.yaml
File metadata and controls
152 lines (151 loc) · 5.29 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# For a detailed breakdown of this workflow, see https://octopus.com/docs/guides/deploy-node-app/to-nginx/using-octopus-onprem-github-builtin
#
# The following workflow provides an opinionated template you can customize for your own needs.
#
# If you are not an Octopus user, the "Push to Octopus", "Generate Octopus Deploy build information",
# and "Create Octopus Release" steps can be safely deleted.
#
# To configure Octopus, set the OCTOPUS_API_TOKEN secret to the Octopus API key, and
# set the OCTOPUS_SERVER_URL secret to the Octopus URL.
#
# Double check the "project" and "deploy_to" properties in the "Create Octopus Release" step
# match your Octopus projects and environments.
#
# Get a trial Octopus instance from https://octopus.com/start
name: Node.js Build
'on':
workflow_dispatch: {}
push: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.15
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Install Octopus Deploy CLI
uses: OctopusDeploy/install-octopus-cli-action@v1
with:
version: latest
- name: Install Dependencies
run: npm ci
shell: bash
- name: List Dependencies
run: npm list --all > dependencies.txt
shell: bash
- name: Collect Dependencies
uses: actions/upload-artifact@v2
with:
name: Dependencies
path: dependencies.txt
- name: List Dependency Updates
run: npm outdated > dependencyUpdates.txt
shell: bash
- name: Collect Dependency Updates
uses: actions/upload-artifact@v2
with:
name: Dependencies Updates
path: dependencyUpdates.txt
- name: Test
run: npm test
shell: bash
- name: Build
run: npm run build
shell: bash
- name: Package
run: |-
SOURCEPATH=.
OUTPUTPATH=.
# If there is a build directory, assume that is what we want to package
if [[ -d "build" ]]; then
SOURCEPATH=build
fi
octo pack \
--basePath ${SOURCEPATH} \
--outFolder ${OUTPUTPATH} \
--id RandomQuotes-JS \
--version ${{ steps.determine_version.outputs.semVer }} \
--format zip \
--overwrite \
--include '**/*.html' \
--include '**/*.htm' \
--include '**/*.css' \
--include '**/*.js' \
--include '**/*.min' \
--include '**/*.map' \
--include '**/*.sql' \
--include '**/*.png' \
--include '**/*.jpg' \
--include '**/*.jpeg' \
--include '**/*.gif' \
--include '**/*.json' \
--include '**/*.env' \
--include '**/*.txt' \
--include '**/*.Procfile'
shell: bash
- name: Tag Release
uses: mathieudutour/github-tag-action@v6.1
with:
custom_tag: ${{ steps.determine_version.outputs.semVer }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- id: create_release
name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }}
release_name: Release ${{ steps.determine_version.outputs.semVer }} Run ${{ github.run_number }} Attempt ${{ github.run_attempt }}
draft: 'false'
prerelease: 'false'
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: RandomQuotes-JS.${{ steps.determine_version.outputs.semVer }}.zip
asset_name: RandomQuotes-JS.${{ steps.determine_version.outputs.semVer }}.zip
asset_content_type: application/octet-stream
- name: Push packages to Octopus Deploy
uses: OctopusDeploy/push-package-action@v3
env:
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }}
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }}
with:
packages: RandomQuotes-JS.${{ steps.determine_version.outputs.semVer }}.zip
overwrite_mode: OverwriteExisting
- name: Generate Octopus Deploy build information
uses: OctopusDeploy/push-build-information-action@v3
env:
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }}
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
with:
version: ${{ steps.determine_version.outputs.semVer }}
packages: RandomQuotes-JS
overwrite_mode: OverwriteExisting
- name: Create Octopus Release
uses: OctopusDeploy/create-release-action@v3
env:
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }}
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }}
with:
project: RandomQuotes-JS
packages: RandomQuotes-JS:${{ steps.determine_version.outputs.semVer }}
permissions:
id-token: write
checks: write
contents: write