dont embed link #918
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
name: .NET | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.x | |
#- name: install runtime | |
# uses: garygrossgarten/github-action-ssh@release | |
# with: | |
# command: sudo apt-get update; sudo apt-get -y upgrade | |
# host: ${{ secrets.REMOTE_HOST }} | |
# username: ${{ secrets.REMOTE_USER }} | |
# passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
# privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: Restore dependencies | |
run: dotnet restore | |
#- name: Build | |
# run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Dotnet Publish | |
run: dotnet publish ETHDINFKBot -p:PublishSingleFile=true -r linux-x64 --self-contained false -c Release -o deploy | |
#- name: Reboot machine | |
# uses: garygrossgarten/github-action-ssh@release | |
# with: | |
# command: sudo reboot | |
# host: ${{ secrets.REMOTE_HOST }} | |
# username: ${{ secrets.REMOTE_USER }} | |
# passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
# privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: Clear /tmp for more diskspace | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: sudo find /tmp -type f -atime +1 -delete | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: Copy via ssh | |
uses: appleboy/[email protected] | |
with: | |
source: /home/runner/work/ETH-DINFK-Bot/ETH-DINFK-Bot/deploy/ | |
target: ${{ secrets.REMOTE_TARGET }} | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.REMOTE_SSH_KEY }} | |
passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
- name: CHMOD the executable | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: rsync -av --exclude='*.log' --delete ${{ secrets.REMOTE_TARGET }}/github/workspace/deploy/* ${{ secrets.REMOTE_TARGET }} && rm -rf ${{ secrets.REMOTE_TARGET }}/github | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: CHMOD the executable | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: chmod +x ${{ secrets.REMOTE_TARGET }}/ETHDINFKBot | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: CHMOD the executable | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: chmod +x ${{ secrets.REMOTE_TARGET }}/chromedriver | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: CHMOD the executable (info.sh) | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: chmod +x ${{ secrets.REMOTE_TARGET }}/Python/python_deploy/info.sh | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | |
privateKey: ${{ secrets.REMOTE_SSH_KEY }} | |
- name: Declare variables | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: HTTP Request Action | |
uses: fjogeleit/[email protected] | |
with: | |
url: '${{ secrets.WEBHOOK_URL }}' | |
method: 'POST' | |
data: '{ "content": "New Build available. Branch: ${{ steps.vars.outputs.branch }} Commit: ${{ steps.vars.outputs.sha_short }}" }' | |