Skip to content

Commit

Permalink
ci: attempt to skip post-semantic actions if no release
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Jun 25, 2022
1 parent ff42da8 commit b6b639d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,23 @@ jobs:
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
with:
semantic_version: 18
semantic_version: 18
extra_plugins: |
@eclass/[email protected]
@semantic-release/git
@semantic-release/exec
- name: Create Sentry release
if: ${{ env.SEMANTIC_RELEASE_COMMENCE == true }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
deploy:
# Built from https://blog.benoitblanchon.fr/github-action-run-ssh-commands/
runs-on: ubuntu-latest
needs: [ semantic-release, test]
steps:
- name: Configure
# Built from https://blog.benoitblanchon.fr/github-action-run-ssh-commands/
- name: Deploy - Configure
if: ${{ env.SEMANTIC_RELEASE_COMMENCE == true }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/prod.key
Expand All @@ -81,11 +80,15 @@ jobs:
SSH_USER: ${{ secrets.PROD_SSH_USER }}
SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
SSH_HOST: ${{ secrets.PROD_SSH_HOST }}
- name: Stop Process
- name: Deploy - Stop Process
if: ${{ env.SEMANTIC_RELEASE_COMMENCE == true }}
run: ssh prod 'source ~/.zshrc && pm2 kill'
- name: Update server
- name: Deploy - Update server
if: ${{ env.SEMANTIC_RELEASE_COMMENCE == true }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && git checkout -- . && git fetch --all && git reset --hard origin/main'
- name: Update dependencies
- name: Deploy - Update dependencies
if: ${{ env.SEMANTIC_RELEASE_COMMENCE == true }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && rm -rf node_modules && nvm install && nvm use && npm ci && npm run build && npm i -g pm2@latest'
- name: Start Process
- name: Deploy - Start Process
if: ${{ env.SEMANTIC_RELEASE_COMMENCE == true }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && pm2 start warframe-status.json'
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@
"release": {
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/exec",
{
"failCmd": "export SEMANTIC_RELEASE_COMMENCE=true"
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
Expand Down

0 comments on commit b6b639d

Please sign in to comment.