Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
5cacfdb574 | |||
060942051f |
2 changed files with 21 additions and 21 deletions
|
@ -1,10 +1,12 @@
|
|||
---
|
||||
name: 'main'
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
main:
|
||||
runs-on: 'self-hosted'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v4'
|
||||
|
@ -17,16 +19,6 @@ jobs:
|
|||
- name: 'check'
|
||||
run: |
|
||||
make check no-dirty
|
||||
build:
|
||||
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||
needs:
|
||||
- 'test'
|
||||
runs-on: 'self-hosted'
|
||||
steps:
|
||||
- uses: 'actions/checkout@v4'
|
||||
- uses: 'actions/setup-go@v5'
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- name: 'build'
|
||||
run: |
|
||||
printf '%s' "$GIT_CRYPT_SECRET" | base64 -d > secret
|
||||
|
@ -36,13 +28,15 @@ jobs:
|
|||
GIT_CRYPT_SECRET: '${{ secrets.GIT_CRYPT }}'
|
||||
#- uses: 'actions/upload-artifact@v4'
|
||||
- uses: 'forgejo/upload-artifact@v4'
|
||||
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||
with:
|
||||
if-no-files-found: 'error'
|
||||
name: 'ods'
|
||||
path: 'ods'
|
||||
deploy:
|
||||
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||
needs:
|
||||
- 'build'
|
||||
- 'main'
|
||||
runs-on: 'self-hosted'
|
||||
steps:
|
||||
#- uses: 'actions/download-artifact@v4'
|
||||
|
@ -50,16 +44,13 @@ jobs:
|
|||
with:
|
||||
name: 'ods'
|
||||
- run: |
|
||||
umask 077
|
||||
printf '%s' "$SSH_PRIVATE_KEY" | base64 -d > private_key
|
||||
SSHOPTS="-i private_key -o StrictHostKeyChecking=accept-new"
|
||||
rsync -e "ssh ${SSHOPTS}" ods ods@ods.adyxax.org:
|
||||
ssh ${SSHOPTS} ods@ods.adyxax.org "chmod +x ods; systemctl --user restart ods"
|
||||
make deploy
|
||||
env:
|
||||
SSH_PRIVATE_KEY: '${{ secrets.SSH_PRIVATE_KEY }}'
|
||||
publish:
|
||||
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||
needs:
|
||||
- 'build'
|
||||
- 'main'
|
||||
runs-on: 'self-hosted'
|
||||
steps:
|
||||
#- uses: 'actions/download-artifact@v4'
|
||||
|
@ -74,4 +65,4 @@ jobs:
|
|||
release-dir: './'
|
||||
token: '${{ env.GITHUB_TOKEN }}'
|
||||
hide-archive-link: true
|
||||
prerelease: true
|
||||
prerelease: false
|
||||
|
|
13
GNUmakefile
13
GNUmakefile
|
@ -37,8 +37,17 @@ push: tidy no-dirty check ## push changes to git remote
|
|||
|
||||
.PHONY: deploy
|
||||
deploy: build ## deploy changes to the production server
|
||||
rsync ./ods ods@ods.adyxax.org:
|
||||
ssh ods@ods.adyxax.org "systemctl --user restart ods"
|
||||
umask 077
|
||||
if [ -n "$${SSH_PRIVATE_KEY:-}" ]; then
|
||||
cleanup() {
|
||||
rm -f private_key
|
||||
}
|
||||
trap cleanup EXIT
|
||||
printf '%s' "$$SSH_PRIVATE_KEY" | base64 -d > private_key
|
||||
SSHOPTS="-i private_key -o StrictHostKeyChecking=accept-new"
|
||||
fi
|
||||
rsync -e "ssh $${SSHOPTS:-}" ./ods ods@ods.adyxax.org:
|
||||
ssh $${SSHOPTS:-} ods@ods.adyxax.org "chmod +x ods; systemctl --user restart ods"
|
||||
|
||||
##### Utils ####################################################################
|
||||
.PHONY: confirm
|
||||
|
|
Loading…
Add table
Reference in a new issue