ci: bump flat-cache from 4.0.1 to 5.0.0 (#1496) #981
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: Release | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Verify | |
env: | |
CI: true | |
TWITTER_KEY: ${{ secrets.TWITTER_KEY }} | |
TWITTER_SECRET: ${{ secrets.TWITTER_SECRET }} | |
TWITTER_TIMEOUT: ${{ secrets.TWITTER_TIMEOUT }} | |
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }} | |
run: | | |
npm ci | |
npm i warframe-items@latest warframe-worldstate-parser@latest warframe-worldstate-data@latest @wfcd/arsenal-parser@latest | |
npm run lint | |
npx commitlint --last --verbose | |
npm run build | |
npm test | |
semantic-release: | |
runs-on: ubuntu-latest | |
needs: [test] | |
outputs: | |
new_version: ${{ steps.semantic.outputs.new_release_version }} | |
release: ${{ steps.release.outputs.release }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '14' | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
with: | |
semantic_version: 17 | |
extra_plugins: | | |
@eclass/semantic-release-sentry-releases@2.11.0 | |
@semantic-release/git | |
@semantic-release/exec | |
- name: Read .release file | |
id: release | |
run: echo "release=$(cat .release)" >> $GITHUB_OUTPUT | |
- name: Create Sentry release | |
if: ${{ steps.release.outputs.release == 'yes' }} | |
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 | |
# Built from https://blog.benoitblanchon.fr/github-action-run-ssh-commands/ | |
- name: Deploy - Configure | |
if: ${{ steps.release.outputs.release == 'yes' }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/prod.key | |
chmod 600 ~/.ssh/prod.key | |
cat >>~/.ssh/config <<END | |
Host prod | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/prod.key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.PROD_SSH_USER }} | |
SSH_KEY: ${{ secrets.PROD_SSH_KEY }} | |
SSH_HOST: ${{ secrets.PROD_SSH_HOST }} | |
- name: Deploy - Stop Process | |
if: ${{ steps.release.outputs.release == 'yes' }} | |
run: ssh prod 'source ~/.zshrc && pm2 kill' | |
- name: Deploy - Update server | |
if: ${{ steps.release.outputs.release == 'yes' }} | |
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && git checkout -- . && git fetch --all && git reset --hard origin/main' | |
- name: Deploy - Update dependencies | |
if: ${{ steps.release.outputs.release == 'yes' }} | |
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: Deploy - Start Process | |
if: ${{ steps.release.outputs.release == 'yes' }} | |
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && pm2 start warframe-status.json' | |
registry-release: | |
needs: semantic-release | |
if: ${{ needs.semantic-release.outputs.release == 'yes' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_PACKAGES_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/wfcd/warframe-status:latest | |
ghcr.io/wfcd/warframe-status:${{ needs.semantic-release.outputs.new_version }} |