Skip to content

Commit

Permalink
actions: github actions for deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
mdirshaddev committed Aug 13, 2023
1 parent e9f8430 commit 41b28cf
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 22 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: '🔎 CodeQL'
name: "🔎 CodeQL"

on: [push,pull_request]
on: [push, pull_request]

jobs:
analyze:
name: '🔎 Analyze'
name: "🔎 Analyze"
runs-on: ubuntu-latest
permissions:
actions: read
Expand All @@ -14,19 +14,19 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['typescript']
language: ["typescript"]

steps:
- name: '💻 Checkout'
- name: "💻 Checkout"
uses: actions/checkout@v3

- name: '⚙️ Initialize CodeQL'
- name: "⚙️ Initialize CodeQL"
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: '🏗️ Autobuild'
- name: "🏗️ Autobuild"
uses: github/codeql-action/autobuild@v2

- name: '🔎 Perform CodeQL Analysis'
- name: "🔎 Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v2
33 changes: 33 additions & 0 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "🏷️ Create Tag"

on:
push:
branches:
- "main"

jobs:
create-tag:
name: "🏷️ Create Tag"
runs-on: ubuntu-latest

steps:
- name: "💻 Checkout"
uses: actions/checkout@v3

- name: "🏷️ Set Tag Output"
id: set-tag
run: echo "::set-output name=tag_name::v$(Scripts/get-version.sh)"

- name: "🏷️ Create Tag"
uses: actions/github-script@v3
env:
TAG: ${{ steps.set-tag.outputs.tag_name }}
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.set-tag.outputs.tag_name }}",
sha: context.sha
})
18 changes: 9 additions & 9 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: '🚀 GitHub Pages'
name: "🚀 GitHub Pages"

# Only trigger, when the build workflow succeeded
on:
release:
types:
- 'published'
- "published"

jobs:
deploy:
name: '🚀 Deploy'
name: "🚀 Deploy"
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

steps:
- name: '💻 Checkout'
- name: "💻 Checkout"
uses: actions/checkout@v3

- name: '⚙️ Setup Node.js v18.17.0'
- name: "⚙️ Setup Node.js v18.17.0"
uses: actions/setup-node@v3
with:
node-version: 18.17.0

- name: '💻 Install Dependency'
- name: "💻 Install Dependency"
run: pnpm install

- name: '🏗️ Create Vite production build'
- name: "🏗️ Create Vite production build"
run: |
export VITE_APP_SUPABASE_URL=${{ secrets.VITE_APP_SUPABASE_URL }}
export VITE_APP_SUPABASE_ANON_KEY=${{ secrets.VITE_APP_SUPABASE_ANON_KEY }}
Expand All @@ -35,10 +35,10 @@ jobs:
export VITE_APP_GOOGLE_ANALYTICS=${{ secrets.VITE_APP_GOOGLE_ANALYTICS }}
pnpm build
- name: '📝 Add .nojekyll file'
- name: "📝 Add .nojekyll file"
run: touch ./dist/.nojekyll

- name: '🚀 Deploy Vite App'
- name: "🚀 Deploy Vite App"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Changelog
name: "🏷️ Update Changelog"

on:
release:
Expand All @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: "💻 Checkout"
uses: actions/checkout@v3
with:
# Fetch entire history of repository to ensure relase date can be
Expand All @@ -20,12 +20,12 @@ jobs:
# is not out of date.
ref: ${{ github.event.release.target_commitish }}

- name: Extract release date from git tag
- name: "⚙️ Extract release date from git tag"
id: release_date
run: |
echo "::set-output name=date::$(git log -1 --date=short --format=%ad '${{ github.event.release.tag_name }}')"
- name: Update Changelog
- name: "🏷️ Update Changelog"
uses: stefanzweifel/changelog-updater-action@v1
with:
# Pass extracted release date, release notes and version to the Action.
Expand All @@ -34,7 +34,7 @@ jobs:
latest-version: ${{ github.event.release.tag_name }}
compare-url-target-revision: ${{ github.event.release.target_commitish }}

- name: Commit updated CHANGELOG
- name: "💻 Commit updated CHANGELOG"
uses: stefanzweifel/git-auto-commit-action@v4
with:
# Push updated CHANGELOG to release target branch.
Expand Down

0 comments on commit 41b28cf

Please sign in to comment.