Skip to content

Commit

Permalink
chore: start of v1 - simplify and improve reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvanleeuwen committed Feb 13, 2024
1 parent ef98a10 commit 6fd086b
Show file tree
Hide file tree
Showing 124 changed files with 8,094 additions and 1,385 deletions.
3 changes: 0 additions & 3 deletions .envrc

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/release_client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Release client package to NPM

on:
push:
branches: [main]
paths:
- "client/**"
workflow_dispatch:
inputs:
release-type:
description: "Release type (one of): patch, minor, major, prepatch, preminor, premajor, prerelease"
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Setup Node.js
uses: actions/setup-node@v2
with:
registry-url: https://registry.npmjs.org/
node-version: "18"

- name: Git configuration
run: |
git config --global user.email "${{ steps.import-gpg.outputs.email }}"
git config --global user.name "${{ steps.import-gpg.outputs.name }}"
- name: Bump release version
if: startsWith(github.event.inputs.release-type, 'pre') != true
run: |
NEW_VERSION=$(npm --no-git-tag-version version ${{ github.event.inputs.release-type }})
echo "NEW_VERSION=client-$NEW_VERSION" >> $GITHUB_ENV
echo "RELEASE_TAG=latest" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
working-directory: client

- name: Bump pre-release version
if: startsWith(github.event.inputs.release-type, 'pre')
run: |
NEW_VERSION=$(npm --no-git-tag-version --preid=beta version ${{ github.event.inputs.release-type }})
echo "NEW_VERSION=client-$NEW_VERSION" >> $GITHUB_ENV
echo "RELEASE_TAG=beta" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
working-directory: client

- name: Update changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: client/CHANGELOG.md
version: ${{ env.NEW_VERSION }}
operation: release

- name: Get version changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: client/CHANGELOG.md
version: ${{ env.NEW_VERSION }}
operation: read

- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.NEW_VERSION }}
body: ${{ steps.get-changelog.outputs.changelog }}
prerelease: ${{ startsWith(github.event.inputs.release-type, 'pre') }}

- name: Commit CHANGELOG.md and package.json changes and create tag
run: |
git add client/package.json client/CHANGELOG.md
git commit -m "release ${{ env.NEW_VERSION }}"
working-directory: client

- name: Install dependencies
run: yarn install
working-directory: client

- name: Push to protected branch
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.PUSH_TO_PROTECTED_BRANCH }}
branch: main
unprotect_reviews: true
tags: true

- name: Publish
run: yarn publish --verbose --access public --tag ${{ env.RELEASE_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
working-directory: client
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Deploy to Fly
on:
push:
branches: [main]
paths:
- "server/**"

jobs:
deploy:
Expand All @@ -29,15 +31,24 @@ jobs:
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
working-directory: server

- name: 🎁 Bump version and push tag
id: release
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: main
DEFAULT_BUMP: patch
- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Determine new version tag
id: versioning
run: |
LATEST_TAG=$(git tag -l "server-v*" --sort=-v:refname | head -n 1)
echo "Latest server tag: $LATEST_TAG"
if [[ "$LATEST_TAG" == "" ]]; then LATEST_TAG="server-v0.0.0"; fi
PARTS=(${LATEST_TAG//./ })
VNUM=${PARTS[2]}
((VNUM++))
NEW_TAG="server-v${PARTS[0]}.${PARTS[1]}.$VNUM"
echo "New tag: $NEW_TAG"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
echo "::set-output name=new_tag::$NEW_TAG"
- name: 🎙 Discord notification 2/3
env:
Expand All @@ -50,3 +61,8 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master

- name: Create and push new t]ag
run: |
git tag ${{ env.NEW_TAG }}
git push origin ${{ env.NEW_TAG }}
22 changes: 7 additions & 15 deletions .github/workflows/sobelow.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# Sobelow is a security-focused static analysis tool for the Phoenix framework. https://sobelow.io/
#
# To use this workflow, you must have GitHub Advanced Security (GHAS) enabled for your repository.
#
# Instructions:
# 2. Follow the annotated workflow below and make any necessary modifications then save the workflow to your repository
# and review the "Security" tab once the action has run.
name: Sobelow

on:
push:
branches: [ "main" ]
branches: ["main"]
paths:
- "server/**"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- "server/**"
schedule:
- cron: '18 11 * * 0'
- cron: "18 11 * * 0"

permissions:
contents: read
Expand Down
28 changes: 18 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
# The directory Mix will write compiled artifacts to.
/_build/
/server/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/
/server/cover/

# The directory Mix downloads your dependencies sources to.
/deps/
/server/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/
/server/doc/

/server/.elixir_ls/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch
/server/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
/server/erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez
/server/*.ez

# Ignore package tarball (built via "mix hex.build").
mave_metrics-*.tar
/server/mave_metrics-*.tar

# Ignore assets that are produced by build tools.
/priv/static/assets/
/server/priv/static/assets/

# Ignore digested assets cache.
/priv/static/cache_manifest.json
/server/priv/static/cache_manifest.json

# In case you use Node.js/npm, you want to ignore these.
npm-debug.log

_pgdata
node_modules
.DS_Store

/client/dist/

.env
.envrc

Loading

0 comments on commit 6fd086b

Please sign in to comment.