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:
|
on:
|
||||||
push:
|
push:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
main:
|
||||||
runs-on: 'self-hosted'
|
runs-on: 'self-hosted'
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v4'
|
- uses: 'actions/checkout@v4'
|
||||||
|
@ -17,16 +19,6 @@ jobs:
|
||||||
- name: 'check'
|
- name: 'check'
|
||||||
run: |
|
run: |
|
||||||
make check no-dirty
|
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'
|
- name: 'build'
|
||||||
run: |
|
run: |
|
||||||
printf '%s' "$GIT_CRYPT_SECRET" | base64 -d > secret
|
printf '%s' "$GIT_CRYPT_SECRET" | base64 -d > secret
|
||||||
|
@ -36,13 +28,15 @@ jobs:
|
||||||
GIT_CRYPT_SECRET: '${{ secrets.GIT_CRYPT }}'
|
GIT_CRYPT_SECRET: '${{ secrets.GIT_CRYPT }}'
|
||||||
#- uses: 'actions/upload-artifact@v4'
|
#- uses: 'actions/upload-artifact@v4'
|
||||||
- uses: 'forgejo/upload-artifact@v4'
|
- uses: 'forgejo/upload-artifact@v4'
|
||||||
|
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||||
with:
|
with:
|
||||||
if-no-files-found: 'error'
|
if-no-files-found: 'error'
|
||||||
name: 'ods'
|
name: 'ods'
|
||||||
path: 'ods'
|
path: 'ods'
|
||||||
deploy:
|
deploy:
|
||||||
|
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||||
needs:
|
needs:
|
||||||
- 'build'
|
- 'main'
|
||||||
runs-on: 'self-hosted'
|
runs-on: 'self-hosted'
|
||||||
steps:
|
steps:
|
||||||
#- uses: 'actions/download-artifact@v4'
|
#- uses: 'actions/download-artifact@v4'
|
||||||
|
@ -50,16 +44,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: 'ods'
|
name: 'ods'
|
||||||
- run: |
|
- run: |
|
||||||
umask 077
|
make deploy
|
||||||
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"
|
|
||||||
env:
|
env:
|
||||||
SSH_PRIVATE_KEY: '${{ secrets.SSH_PRIVATE_KEY }}'
|
SSH_PRIVATE_KEY: '${{ secrets.SSH_PRIVATE_KEY }}'
|
||||||
publish:
|
publish:
|
||||||
|
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
|
||||||
needs:
|
needs:
|
||||||
- 'build'
|
- 'main'
|
||||||
runs-on: 'self-hosted'
|
runs-on: 'self-hosted'
|
||||||
steps:
|
steps:
|
||||||
#- uses: 'actions/download-artifact@v4'
|
#- uses: 'actions/download-artifact@v4'
|
||||||
|
@ -74,4 +65,4 @@ jobs:
|
||||||
release-dir: './'
|
release-dir: './'
|
||||||
token: '${{ env.GITHUB_TOKEN }}'
|
token: '${{ env.GITHUB_TOKEN }}'
|
||||||
hide-archive-link: true
|
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
|
.PHONY: deploy
|
||||||
deploy: build ## deploy changes to the production server
|
deploy: build ## deploy changes to the production server
|
||||||
rsync ./ods ods@ods.adyxax.org:
|
umask 077
|
||||||
ssh ods@ods.adyxax.org "systemctl --user restart ods"
|
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 ####################################################################
|
##### Utils ####################################################################
|
||||||
.PHONY: confirm
|
.PHONY: confirm
|
||||||
|
|
Loading…
Add table
Reference in a new issue