Repository navigation
.github/workflows/main.yml #231
This file contains hidden or 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
| on: push | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - windows | |
| - macos | |
| - ubuntu | |
| runs-on: ${{ matrix.os }}-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| - uses: actions/setup-node@main | |
| with: | |
| node-version: latest | |
| - run: | | |
| npm install-ci-test | |
| npx package | |
| mv ../kill-the-newsletter.${{ matrix.os == 'windows' && 'zip' || 'tar.gz' }} ./kill-the-newsletter--${{ matrix.os }}--${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }}.${{ matrix.os == 'windows' && 'zip' || 'tar.gz' }} | |
| - uses: actions/upload-artifact@main | |
| with: | |
| path: ./kill-the-newsletter--${{ matrix.os }}--${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }}.${{ matrix.os == 'windows' && 'zip' || 'tar.gz' }} | |
| name: kill-the-newsletter--${{ matrix.os }}--${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }}.${{ matrix.os == 'windows' && 'zip' || 'tar.gz' }} | |
| - if: ${{ matrix.os == 'ubuntu' && startsWith(github.ref, 'refs/tags/v') }} | |
| uses: webfactory/ssh-agent@master | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - if: ${{ matrix.os == 'ubuntu' && startsWith(github.ref, 'refs/tags/v') }} | |
| run: | | |
| cat >> ~/.ssh/known_hosts << "EOF" | |
| $ ssh-keyscan kill-the-newsletter.com | |
| # kill-the-newsletter.com:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.11 | |
| kill-the-newsletter.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMYkjNwmcUiRukJuoAA7JYtTF1xG3HPEa/QzIdGY0pb | |
| # kill-the-newsletter.com:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.11 | |
| kill-the-newsletter.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvUeZIIcFYMFzJAxqen3pWi0E4LP/V1vhaqs926jCxn4YqXAdBLdBaJ6cS6pq7cER0UrHqPXdGONQd0gyH3sFh3EJ/FJGaMvmhrWsfjM03vBDUWm84h7DId57TGgZCGClWdb2Mbhvxpl2Rw87Iiq+Wp//DDPfIl6QPTTwPF8b4V8Wx0Qv2pAXIZrO7eRrJpMaQPSUqaj2A94Hui1hVdl9jvfa/iYwvOguP8e4L9wI3b05ItHjg+v70GYbDCuSw045UAu5wfjlOHlJXi+h93gUSU2XmylTxssDW77agGpkIYDLeuxYxjhWAWJNbyGDiBYTjT1lNbFT4RWrJs9fURw0bc7zQCf74UUxkAinnfXllCgAroVlniJxSz9/87dWDvlRsIncz6SryX2g/lTSM8Yd290AqM2q2fvpCGJ0h6om71yNxsH1P5BaIZwJ74XhZwUVy1OK3th+OoZPLFMYwoi309188kdgWJ1CiJLkWQnoKjjiG7CD4rEaREWRThWPqb9k= | |
| # kill-the-newsletter.com:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.11 | |
| kill-the-newsletter.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL8H/sc/goyCkg77Vj7Dr/Mf89yUUazhunpjiWGUzuLJclWt9R/JFWmRM7o1lQjVaFxE53CCbD8pLQCO4etApSs= | |
| # kill-the-newsletter.com:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.11 | |
| # kill-the-newsletter.com:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.11 | |
| EOF | |
| rsync -a ./kill-the-newsletter--ubuntu--${{ github.ref_name }}.tar.gz root@kill-the-newsletter.com:/mnt/kill-the-newsletter/kill-the-newsletter--ubuntu--${{ github.ref_name }}.tar.gz | |
| ssh root@kill-the-newsletter.com << "EOF" | |
| mkdir -p /mnt/kill-the-newsletter/kill-the-newsletter/ | |
| rm -rf /mnt/kill-the-newsletter/kill-the-newsletter--deploy/ | |
| mkdir /mnt/kill-the-newsletter/kill-the-newsletter--deploy/ | |
| mv /mnt/kill-the-newsletter/kill-the-newsletter--ubuntu--${{ github.ref_name }}.tar.gz /mnt/kill-the-newsletter/kill-the-newsletter--deploy/kill-the-newsletter--ubuntu--${{ github.ref_name }}.tar.gz | |
| cd /mnt/kill-the-newsletter/kill-the-newsletter--deploy/ | |
| tar -xzf ./kill-the-newsletter--ubuntu--${{ github.ref_name }}.tar.gz | |
| cp /mnt/kill-the-newsletter/kill-the-newsletter--deploy/kill-the-newsletter/_/configuration/kill-the-newsletter.com.mjs /mnt/kill-the-newsletter/kill-the-newsletter/configuration.mjs | |
| systemctl stop kill-the-newsletter || true | |
| cp /mnt/kill-the-newsletter/kill-the-newsletter--deploy/kill-the-newsletter/_/configuration/kill-the-newsletter.service /etc/systemd/system/kill-the-newsletter.service | |
| systemctl daemon-reload | |
| mv /mnt/kill-the-newsletter/kill-the-newsletter/kill-the-newsletter/ /mnt/kill-the-newsletter/kill-the-newsletter--deploy/kill-the-newsletter--old/ || true | |
| mv /mnt/kill-the-newsletter/kill-the-newsletter--deploy/kill-the-newsletter/ /mnt/kill-the-newsletter/kill-the-newsletter/kill-the-newsletter/ | |
| systemctl start kill-the-newsletter | |
| systemctl enable kill-the-newsletter | |
| rm -rf /mnt/kill-the-newsletter/kill-the-newsletter--deploy/ | |
| EOF | |
| release: | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@main | |
| - uses: softprops/action-gh-release@master | |
| with: | |
| files: ./**/*.* |