-
-
Notifications
You must be signed in to change notification settings - Fork 544
137 lines (128 loc) · 4.77 KB
/
dev-release-windoze.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Dev Release Windoze Installer
on:
push:
branches:
- main
- 'preview/**'
jobs:
dev-release-windows-installer:
runs-on: ${{ matrix.os }}
env:
WINDOZE_CERT_DATA: ${{ secrets.WINDOZE_CERT_DATA }}
WINDOZE_CERT_PASSWORD: ${{ secrets.WINDOZE_CERT_PASSWORD }}
TERM: xterm
strategy:
matrix:
os:
- windows-2022
node-version:
- '18'
arch:
- x64
steps:
# Install deps and cache
# Eventually it would be great if these steps could live in a separate YAML file
# that could be included in line to avoid code duplication
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set other variables
id: vars
shell: bash
run: |
# Set generic source ref vars
echo "source-name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "source-branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "source-tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
# Unset vars if it makes sense to do so
if [ "$GITHUB_REF" == "${GITHUB_REF#refs/tags/}" ]; then
echo "source-tag=" >> $GITHUB_OUTPUT
fi
if [ "$GITHUB_REF" == "${GITHUB_REF#refs/heads/}" ]; then
echo "source-branch=" >> $GITHUB_OUTPUT
fi
- name: Test user defined variables
shell: bash
run: |
echo "The SOURCE_NAME is ${{ steps.vars.outputs.source-name }}"
echo "The SOURCE_BRANCH is ${{ steps.vars.outputs.source-branch }}"
echo "The SOURCE_TAG is ${{ steps.vars.outputs.source-tag }}"
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile
# Import ENVVARS from build.env
# @NOTE: We do this so there is a single place to update versions
- name: Import build version envvars
id: import-env
shell: bash
run: |
while read line; do
echo "$line" >> $GITHUB_ENV
done < BUILD.env
# Build and prep the release
- name: Prepare Release
uses: lando/prepare-release-action@v3
with:
version: dev
sync: false
- name: Ensure version
run: node -pe 'JSON.parse(process.argv[1]).version' "$(cat package.json)"
shell: bash
- name: Import and verify certs
shell: powershell
run: scripts/import-win-certs.ps1
- name: Assemble pieces
shell: powershell
run: scripts/assemble-win.ps1
- name: Create and sign package
shell: powershell
run: scripts/create-exe.ps1
# Create and upload releases
- name: Create releases
env:
SOURCE_BRANCH: ${{ steps.vars.outputs.source-branch }}
SOURCE_TAG: ${{ steps.vars.outputs.source-tag }}
ARCH: ${{ matrix.arch }}
shell: bash
run: |
# Create release directories
mkdir -p dist releases dev-builds
# Move from build dir to dist
cp -f "build/installer/dist/LandoInstaller.exe" "dist/LandoInstaller.exe"
# Snapshot release
cp -f "dist/LandoInstaller.exe" "dev-builds/lando-build-${{ github.sha }}-$ARCH.exe"
# Branch releases
if [ -z "$SOURCE_TAG" ]; then cp -f "dist/LandoInstaller.exe" "releases/lando-$ARCH-$SOURCE_BRANCH-latest.exe"; fi
# Latest dev release
if [[ "$SOURCE_BRANCH" == "main" ]]; then cp -f "dist/LandoInstaller.exe" "releases/lando-$ARCH-latest.exe"; fi
# Latest dev release 2
if [[ "$SOURCE_BRANCH" == "main" ]]; then cp -f "dist/LandoInstaller.exe" "releases/lando-$ARCH-dev.exe"; fi
# Print what we end up with
ls -lsa releases
ls -lsa dev-builds
# Upload back to Actions
- name: Upload build snapshot as Actions artifact
uses: actions/upload-artifact@v3
with:
name: lando-build-${{ github.sha }}-${{ matrix.arch}}.exe
path: dev-builds/
if-no-files-found: error
retention-days: 30
# Upload releases to S3
- name: Configure S3 Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.S3_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload releases to S3
shell: bash
run: |
aws s3 sync releases s3://files.lando.dev/installer
# Below is for backwards compatibility
aws s3 sync releases s3://files.lando.dev