以前更新程式到伺服器
Learn More →
為了保持一致改用 git, github (很多人一起寫時,不用git很容易出錯)
Learn More →
讓他變自動
Learn More →
name: 'Github Actions'
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Specify node version
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install node_modules
run:
npm ci
- name: Lint
run:
npm run lint
- name: Test
run:
npm run test
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Set up the private key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Set known_hosts
run: echo "${{ secrets.KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
- name: Connect to the production environment
run: ssh ${{ secrets.USER_HOST }} '
cd /srv/node/my_project
&& git pull
&& npm ci
'
https://stackoverflow.com/questions/67516571/github-action-triggered-by-success-of-a-different-action
https://stackoverflow.com/questions/63148639/create-dependencies-between-jobs-in-github-actions
https://ubuntudroid.medium.com/labeling-github-auto-merge-pull-requests-d5a86f62280a
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up