140 lines
6.1 KiB
YAML
140 lines
6.1 KiB
YAML
on: push
|
|
jobs:
|
|
insiders-build:
|
|
strategy:
|
|
matrix:
|
|
os: [windows, macos, ubuntu]
|
|
include:
|
|
- os: windows
|
|
build: npx caxa --directory . --command "{{caxa}}/node_modules/.bin/node" "{{caxa}}/lib/index.js" --output "kill-the-newsletter--windows--${{ github.sha }}.exe"
|
|
artifact: kill-the-newsletter--windows--${{ github.sha }}.exe
|
|
- os: macos
|
|
build: |
|
|
npx caxa --directory . --command "{{caxa}}/node_modules/.bin/node" "{{caxa}}/lib/index.js" --output "kill-the-newsletter"
|
|
tar -czf "kill-the-newsletter--macos--${{ github.sha }}.tgz" "kill-the-newsletter"
|
|
artifact: kill-the-newsletter--macos--${{ github.sha }}.tgz
|
|
- os: ubuntu
|
|
build: |
|
|
npx caxa --directory . --command "{{caxa}}/node_modules/.bin/node" "{{caxa}}/lib/index.js" --output "kill-the-newsletter"
|
|
tar -czf "kill-the-newsletter--linux--${{ github.sha }}.tgz" "kill-the-newsletter"
|
|
artifact: kill-the-newsletter--linux--${{ github.sha }}.tgz
|
|
runs-on: ${{ matrix.os }}-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 15
|
|
- run: |
|
|
npm ci
|
|
${{ matrix.build }}
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.artifact }}
|
|
path: ${{ matrix.artifact }}
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os: [windows, macos, ubuntu]
|
|
runs-on: ${{ matrix.os }}-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 15
|
|
- run: npm install-ci-test
|
|
|
|
deploy:
|
|
if: github.ref == 'refs/heads/main'
|
|
needs: [insiders-build, test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: webfactory/ssh-agent@v0.5.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: kill-the-newsletter--linux--${{ github.sha }}.tgz
|
|
- run: |
|
|
tar -xzf kill-the-newsletter--linux--${{ github.sha }}.tgz
|
|
|
|
cat >> ~/.ssh/known_hosts << "EOF"
|
|
kill-the-newsletter.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBQiZK4dxdZl6d6f2gpQxuVcwqvJo9JcnoEgfJ4fNjbY
|
|
kill-the-newsletter.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDNZ75UdvVaHOk86fF1TslxKWCGsRG7EfF4Rq2TqeZ1ZWbjc89gpl2G0jVQ1hSwo0KhvmZkpXJsCgQaOnR7kDMjHLdvnwGb6Uqnolef4LqZlso3i3L0dMxbHsBtq/laC1/Zk/sWXs2UO1oZaMNrjqaf+1CjUdkSQFFMoF8oVdgfg3SAidRs+8/WdZbfAjEfDqYONKk1iMRPUTVtN5H4LSJUpJsPx+T8QrDpRez820A3WLAxVbIdVU42Fa1VI8J+C/0Z6/iJcF6/7HRp1zcUWILFPu4t5VzBFVtaVSgkm29TiGfZiz8X/YFF+GRCW+Ht5bObDOEDFNLdrY/xyyqp3h0b9zSTUC5xKqugIiewUtULIT6W9cXxJdbW56W9jlRIlzHfzsB/rcXQC/+HIHWQsJYCF3LCE6JR+R9UfsSV2pR1TseA/9ARD5A2I//cXGxkDyTnWVdcxiHUQbWWq/B+pnfi+EwG0HTUgZWOH9pHJ3apGnHmudii6MAnFplMMzv8ULU=
|
|
kill-the-newsletter.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBO5UFbB8oNfTXEYFpvykTCrlyeEFSMpAWKa5Nfc0hid2fr1t26rG9t/7DZk2J7MAyvbZecDVY9XGA+ku3RdO/qs=
|
|
EOF
|
|
|
|
ssh root@kill-the-newsletter.com "mkdir -p kill-the-newsletter"
|
|
rsync -a kill-the-newsletter root@kill-the-newsletter.com:kill-the-newsletter/kill-the-newsletter
|
|
rsync -a deployment-example/configuration.js root@kill-the-newsletter.com:kill-the-newsletter/configuration.js
|
|
rsync -a deployment-example/kill-the-newsletter.service root@kill-the-newsletter.com:/etc/systemd/system/kill-the-newsletter.service
|
|
|
|
ssh root@kill-the-newsletter.com << "EOF"
|
|
systemctl daemon-reload
|
|
systemctl enable kill-the-newsletter
|
|
systemctl restart kill-the-newsletter
|
|
EOF
|
|
|
|
npm-publish:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 15
|
|
registry-url: https://registry.npmjs.org/
|
|
- run: npm ci && npm publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [insiders-build, test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: kill-the-newsletter--windows--${{ github.sha }}.exe
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: kill-the-newsletter--macos--${{ github.sha }}.tgz
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: kill-the-newsletter--linux--${{ github.sha }}.tgz
|
|
- run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
|
|
id: tag
|
|
- uses: actions/create-release@v1
|
|
id: create-release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.tag.outputs.tag }}
|
|
release_name: Release ${{ steps.tag.outputs.tag }}
|
|
- uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_path: kill-the-newsletter--windows--${{ github.sha }}.exe
|
|
asset_name: kill-the-newsletter--windows--${{ steps.tag.outputs.tag }}.exe
|
|
asset_content_type: application/vnd.microsoft.portable-executable
|
|
- uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_path: kill-the-newsletter--macos--${{ github.sha }}.tgz
|
|
asset_name: kill-the-newsletter--macos--${{ steps.tag.outputs.tag }}.tgz
|
|
asset_content_type: application/gzip
|
|
- uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_path: kill-the-newsletter--linux--${{ github.sha }}.tgz
|
|
asset_name: kill-the-newsletter--linux--${{ steps.tag.outputs.tag }}.tgz
|
|
asset_content_type: application/gzip
|