-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (55 loc) · 1.85 KB
/
release.yml
File metadata and controls
60 lines (55 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the release version
id: get_release_version
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
shell: bash
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build src/DevTranslate.Api/DevTranslate.Api.csproj --configuration Release --no-restore -p:Version=${{ steps.get_release_version.outputs.tag }}.0
- name: Publish
run: dotnet publish src/DevTranslate.Api/DevTranslate.Api.csproj --configuration Release --no-restore --no-build --output published
- name: Upload Build Artifacts
uses: actions/upload-artifact@v2.2.2
with:
name: build
path: published
deploy:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v2.0.8
with:
name: build
path: published
- name: Transfering files
uses: garygrossgarten/github-action-scp@v0.7.3
with:
local: published
remote: /var/sites/api.devtranslate.io
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USERNAME }}
privateKey: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
atomicPut: true
- name: Restarting service
uses: garygrossgarten/github-action-ssh@v0.6.3
with:
command: sudo /usr/bin/systemctl restart devtranslate-api.service
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USERNAME }}
privateKey: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}