➕ merge pull request #431 from devmount/dependabot/npm_and_yarn/vite-… #291
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
# This workflow will do a clean install of node dependencies | |
# and build the application with node | |
# It creates a thunderbird add-on .xpi file from it and stores it as artifact | |
name: Nightly build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
# create the build files and push them to CDN | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- name: Get Timestamp | |
id: timestamp | |
run: | | |
d=$(date +%s) | |
echo "Current timestamp is ${d}" | |
echo ::set-output name=now::${d} | |
- name: Get Version | |
id: version | |
run: | | |
PACKAGE_JSON_PATH="${1-.}" | |
echo "Reading package.json from ${PACKAGE_JSON_PATH}/package.json" | |
patch=v$(cat ${PACKAGE_JSON_PATH}/package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') | |
echo "Got version ${patch}. Now increment it!" | |
[[ ${patch::-2} =~ ([^0-9].*)([0-9]+) ]] | |
next="${BASH_REMATCH[1]}$(( ${BASH_REMATCH[2]} + 1 ))" | |
echo "Assumed next version is ${next}" | |
echo ::set-output name=next::${next} | |
- name: Build filename | |
id: file | |
run: | | |
filename=third-stats_${{ steps.version.outputs.next }}-alpha.${{ steps.timestamp.outputs.now }}.xpi | |
echo "Built filename ${filename}" | |
echo ::set-output name=name::${filename} | |
- name: Build app using NPM | |
run: | | |
npm install | |
npm run build | |
- name: Create Thunderbird add-on (.xpi) | |
shell: bash | |
run: | | |
cd dist/ | |
zip -q -r ../${{ steps.file.outputs.name }} ./ | |
- name: Upload add-on nightly build artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: third-stats-nightly | |
path: ${{ steps.file.outputs.name }} | |
- name: Push add-on to CDN | |
uses: burnett01/rsync-deployments@5.2 | |
with: | |
switches: -avzr --delete | |
path: ${{ steps.file.outputs.name }} | |
remote_path: ${{ secrets.CDN_PATH }} | |
remote_host: ${{ secrets.CDN_HOST }} | |
remote_port: ${{ secrets.CDN_PORT }} | |
remote_user: ${{ secrets.CDN_USER }} | |
remote_key: ${{ secrets.CDN_SSH_KEY }} | |
remote_key_pass: ${{ secrets.CDN_SSH_PHRASE }} |