Closed Alwinator closed 3 years ago
I forgot to write
- name: Checkout
uses: actions/checkout@v2
Sorry for the disturbance.
@Alwinator having this issue myself-- I've added the checkout action, but what does the rest of your action look like, if you don't mind sharing.
This is my full workflow. It runs on all branches if the commit message does not start with WIP, but only deploys the main and release branches. First, it tests my NodeJS application, and if the tests succeed it deploys the main branch to my preview Caprover app and the release branch to my production Caprover app.
name: Test, Build and Deploy to Home-Hosting
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
test:
if: "!startsWith(github.event.head_commit.message, 'WIP')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up npm
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependecies
run: npm install
- name: Run tests
run: npm run test
deploy-main:
if: github.ref == 'refs/heads/main'
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Caprover Deploy
uses: AlexxNB/caprover-action@v1
with:
server: 'https://example.com'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appname: 'myapp-main'
branch: 'main'
deploy-release:
if: github.ref == 'refs/heads/release'
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Caprover Deploy
uses: AlexxNB/caprover-action@v1
with:
server: 'https://example.com
password: '${{ secrets.CAPROVER_PASSWORD }}'
appname: 'myapp'
branch: 'release'