Update forgejo actions workflow to rsync to the server on push to master/develop (#207)
- Update the forgejo actions workflow to rsync to the server on push to the master/develop branch #204 Reviewed-on: #207 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
95afc76a5c
commit
d85c812fbb
4 changed files with 37 additions and 93 deletions
|
@ -31,6 +31,8 @@ jobs:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
|
- run: yarn package
|
||||||
|
- run: cp -r ./bin ${{ secrets.PROD_REPO_PATH }}
|
||||||
- uses: https://github.com/JS-DevTools/npm-publish@v3
|
- uses: https://github.com/JS-DevTools/npm-publish@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.NPM_TOKEN }}
|
token: ${{ secrets.NPM_TOKEN }}
|
35
.forgejo/workflows/staging.yml
Normal file
35
.forgejo/workflows/staging.yml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
name: Stage
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: node
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20.x
|
||||||
|
- run: yarn install --frozen-lockfile
|
||||||
|
- run: yarn build
|
||||||
|
- run: yarn test
|
||||||
|
- run: yarn lint
|
||||||
|
|
||||||
|
rsync:
|
||||||
|
needs: build
|
||||||
|
runs-on: node
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20.x
|
||||||
|
- run: yarn install --frozen-lockfile
|
||||||
|
- run: yarn build
|
||||||
|
- run: yarn package
|
||||||
|
- run: cp -r ./bin ${{ secrets.STAGE_REPO_PATH }}
|
|
@ -7,7 +7,6 @@ on:
|
||||||
- hotfix/*
|
- hotfix/*
|
||||||
- renovate/*
|
- renovate/*
|
||||||
- dependabot/*
|
- dependabot/*
|
||||||
- develop
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
steps:
|
|
||||||
build:
|
|
||||||
# Build and test
|
|
||||||
image: node
|
|
||||||
commands:
|
|
||||||
- yarn install --frozen-lockfile
|
|
||||||
- yarn build
|
|
||||||
when:
|
|
||||||
event: [ push, pull_request ]
|
|
||||||
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
|
|
||||||
lint:
|
|
||||||
image: node
|
|
||||||
commands:
|
|
||||||
- yarn lint
|
|
||||||
when:
|
|
||||||
event: [ push, pull_request ]
|
|
||||||
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
|
|
||||||
test:
|
|
||||||
image: node
|
|
||||||
commands:
|
|
||||||
- yarn test
|
|
||||||
when:
|
|
||||||
event: [ push, pull_request ]
|
|
||||||
branch: [ hotfix/*, feature/*, renovate/*, develop, main ]
|
|
||||||
|
|
||||||
# Package production build
|
|
||||||
package_prod:
|
|
||||||
image: node
|
|
||||||
commands:
|
|
||||||
- apt install unzip -y
|
|
||||||
- wget https://github.com/xerub/ldid/releases/download/42/ldid.zip
|
|
||||||
- unzip ldid.zip
|
|
||||||
- mkdir /opt/ldid/
|
|
||||||
- cp linux64/ldid /opt/ldid/
|
|
||||||
- export PATH=/opt/ldid:$PATH
|
|
||||||
- yarn package
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
branch: main
|
|
||||||
rsync_prod:
|
|
||||||
image: alpine
|
|
||||||
secrets: [ ssh_key ]
|
|
||||||
commands:
|
|
||||||
- apk add rsync openssh-client
|
|
||||||
- eval `ssh-agent -s`
|
|
||||||
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
|
|
||||||
- rsync -e "ssh -o StrictHostKeyChecking=no" -r ./bin vylpes@192.168.1.115:/home/vylpes/apps/random-bunny/random-bunny_prod
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
branch: main
|
|
||||||
|
|
||||||
# Package stage build
|
|
||||||
package_stage:
|
|
||||||
image: node
|
|
||||||
commands:
|
|
||||||
- apt install unzip -y
|
|
||||||
- wget https://github.com/xerub/ldid/releases/download/42/ldid.zip
|
|
||||||
- unzip ldid.zip
|
|
||||||
- mkdir /opt/ldid/
|
|
||||||
- cp linux64/ldid /opt/ldid/
|
|
||||||
- export PATH=/opt/ldid:$PATH
|
|
||||||
- yarn package
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: develop
|
|
||||||
rsync_stage:
|
|
||||||
image: alpine
|
|
||||||
secrets: [ ssh_key ]
|
|
||||||
commands:
|
|
||||||
- apk add rsync openssh-client
|
|
||||||
- eval `ssh-agent -s`
|
|
||||||
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
|
|
||||||
- rsync -e "ssh -o StrictHostKeyChecking=no" -r ./bin vylpes@192.168.1.115:/home/vylpes/apps/random-bunny/random-bunny_stage
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: develop
|
|
||||||
|
|
||||||
# Publish to NPM
|
|
||||||
publish:
|
|
||||||
image: plugins/npm
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: NPM_USERNAME
|
|
||||||
email:
|
|
||||||
from_secret: NPM_EMAIL
|
|
||||||
password:
|
|
||||||
from_secret: NPM_PASSWORD
|
|
||||||
api_key:
|
|
||||||
from_secret: NPM_TOKEN
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
branch: main
|
|
Loading…
Reference in a new issue