Merge pull request #10 from XigmaDev/3-vless-host-in-ws-transport-pro… #17
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
on: | |
push: | |
branches: [ main ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint-build-test: | |
name: Lint, Build, Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
override: true | |
- name: Check Formatting | |
run: cargo fmt --all -- --check | |
- name: Build | |
run: cargo build --all-features | |
- name: Run Tests | |
run: cargo test --all-features | |
- name: Run clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
release: | |
name: Create Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: lint-build-test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Build Release | |
run: cargo build --release | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: Release ${{ github.ref_name }} | |
body: | | |
Automated release for version ${{ github.ref_name }} | |
files: | | |
target/release/bot | |
overwrite: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bot | |
path: "target/release/bot" | |
- name: Upload binary via SCP | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.PORT }} | |
source: "target/release/bot" | |
target: "/home/${{ secrets.SSH_USERNAME }}/uri2json_bot/uri2json" | |
- name: Restart application via SSH | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
echo "TELOXIDE_TOKEN=${{ secrets.BOT_TOKEN }}" > /home/${{ secrets.SSH_USERNAME }}/uri2json_bot/.env | |
sudo chmod +x /home/${{ secrets.SSH_USERNAME }}/uri2json_bot/uri2json | |
sudo systemctl restart uri2json.service |