Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

chore: deprecation notice #71

chore: deprecation notice

chore: deprecation notice #71

Workflow file for this run

---
jobs:
build:
runs-on: ubuntu-20.04
steps:
# Checkout the repository
- uses: actions/checkout@v3
# Run conventional commits and determine if the release requires building
- id: changelog
name: Conventional Changelog Action
uses: TriPSs/conventional-changelog-action@v3
with:
git-message: "chore(release): {version}"
git-pull-method: "--ff-only"
github-token: ${{ secrets.GITHUB_TOKEN }}
preset: angular
release-count: "0"
skip-commit: "false"
skip-version-file: "false"
tag-prefix: v
version-file: Cargo.toml
version-path: package.version
# Load the rust toolchain
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
# Load any cache stored by rust-cache.
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: Swatinem/rust-cache@v1
# Run cargo build (for release)
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: actions-rs/cargo@v1
with:
args: "--release"
command: build
# Run cargo test (for release)
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: actions-rs/cargo@v1
with:
args: "--release"
command: test
# Install our SSH key
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: "placeholder"
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: mkdir magnesium-release/
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: cp -R src/templates/ magnesium-release/templates
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: cp target/release/magnesium-oxide magnesium-release/magnesium-oxide
# Tarball all the files in the release directory.
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: tar -czvf magnesium-release.tar magnesium-release/*
# Set known hosts
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
# Stop the "magnesium" systemd service over ssh
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Stopping magnesium
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "sudo -S <<< ${{ secrets.SSH_PASS }} systemctl stop magnesium"
# Deploy the release tarball to the remote server via rsync
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Deploying release
run: rsync -avz magnesium-release.tar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/tmp/magnesium-release.tar
# Remove the binary and templates directory from the remote server.
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Removing old release
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "sudo -S <<< ${{ secrets.SSH_PASS }} rm -rf /srv/magnesium-release/magnesium-oxide /srv/magnesium-release/templates"
# Extract the release tarball on the remote server
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Extracting release
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "sudo -S <<< ${{ secrets.SSH_PASS }} tar -xvzf /tmp/magnesium-release.tar -C /srv/"
# Start the "magnesium" systemd service over ssh.
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Starting magnesium
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "sudo -S <<< ${{ secrets.SSH_PASS }} systemctl start magnesium"
# Deploy the release artifacts to GitHub
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: magnesium-oxide - ${{ steps.changelog.outputs.version }}
path: magnesium-release.tar
# Create a release on GitHub with the release notes
- if: ${{ steps.changelog.outputs.skipped == 'false' }}
name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: magnesium-release.tar
body: ${{ steps.changelog.outputs.clean_changelog }}
draft: false
name: ${{ steps.changelog.outputs.tag }}
prerelease: false
tag: ${{ steps.changelog.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
name: Build and Deploy
"on":
push:
branches:
- main