-
Notifications
You must be signed in to change notification settings - Fork 92
113 lines (96 loc) · 3.09 KB
/
build-astro.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Deploy
on:
# Disable on push temporarily while we're doing the migration
workflow_dispatch:
push:
branches: [ main ]
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: true
env:
SHOULD_DEPLOY: ${{ secrets.OCTOPUSSERVERURL != '' || '' }}
OCTOPUS_URL: ${{ secrets.OCTOPUSSERVERURL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUSSERVERAPIKEY }}
OCTOPUS_SPACE: "DevOps Microsite"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.10.0
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- name: PNPM and Playwright install
run: |
echo; echo "cd to workspace"
cd $GITHUB_WORKSPACE
echo; echo "listing"
ls
echo; echo "NPM install"
pnpm install
- name: Astro build and test
run: |
export NODE_OPTIONS=--max_old_space_size=4096
pnpm dev:img
pnpm test
node ./src/themes/octopus/utilities/page-report.js
- name: Set Version
run: |
echo "PACKAGE_VERSION=$(date +'%Y.%m.%d').$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
- name: Check output
run: |
echo; echo "cd to workspace"
cd $GITHUB_WORKSPACE
echo; echo "listing"
ls
- name: Create a Zip package 🐙
id: package
uses: OctopusDeploy/create-zip-package-action@v3
with:
package_id: 'DocsMicrosite'
version: "${{ env.PACKAGE_VERSION }}"
base_path: "./dist"
output_folder: "./artifacts"
files: |
**/*.*
- name: Push a package to Octopus Deploy 🐙
uses: OctopusDeploy/[email protected]
if: ${{ env.SHOULD_DEPLOY }}
with:
packages: ${{ steps.package.outputs.package_file_path }}
- name: Let people download package
uses: actions/upload-artifact@v3
if: ${{ ! env.SHOULD_DEPLOY }}
with:
name: docs-microsite
path: ${{ steps.package.outputs.package_file_path }}
- name: Push build information to Octopus Deploy 🐙
uses: OctopusDeploy/push-build-information-action@v3
if: ${{ env.SHOULD_DEPLOY }}
with:
version: "${{ env.PACKAGE_VERSION }}"
packages: ${{ steps.package.outputs.package_file_path }}
- name: Create a release in Octopus Deploy 🐙
id: "create_release"
uses: OctopusDeploy/create-release-action@v3
if: ${{ env.SHOULD_DEPLOY }}
with:
project: "Docs Microsite"
package_version: "${{ env.PACKAGE_VERSION }}"
git_ref: ${{ github.ref }}