stormphlegyas is running CI/CD π #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
run-name: ${{ github.actor }} is running CI/CD π | |
on: | |
pull_request: | |
branches: [ master ] | |
push: | |
branches: [ master ] | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: sudo apt-get install xvfb | |
- run: npm install | |
- run: xvfb-run -a npm run test -- --headless | |
deploy: | |
name: Deploy to Marketplace | |
needs: test | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
run: npm install | |
- name: Install vsce tool | |
run: npm install -g vsce | |
- name: Publish to Marketplace | |
run: vsce publish -p ${{ secrets.VSCE_PAT }} | |
push: | |
name: Push changes | |
needs: deploy | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Moustoifa Moumini" | |
- name: Increment version | |
run: npm version patch | |
- name: Push changes to branch | |
run: git push origin master |