Skip to content

Commit

Permalink
Add github release action
Browse files Browse the repository at this point in the history
  • Loading branch information
jrsmth-tier2 committed Mar 12, 2024
1 parent 25aec12 commit 151ca40
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
Empty file added .github/workflows/develop.yaml
Empty file.
19 changes: 19 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: main
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
jobs:
# test:
# name: test
# uses: ./.github/workflows/step-test.yaml
release:
# needs: test
name: release
uses: ./.github/workflows/step-release.yaml
merge:
needs: release
name: merge
uses: ./.github/workflows/step-merge.yaml
17 changes: 17 additions & 0 deletions .github/workflows/step-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: merge
on:
workflow_call:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Merge into Develop ➡️
uses: devmasx/merge-branch@master
with:
type: now
from_branch: main
target_branch: develop
message: Merge version bump into develop
github_token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/step-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release
on:
workflow_call:
jobs:
release:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Set-up User 🐵
uses: fregante/setup-git-user@v2
- name: Bump and Tag 🏷️
run: |
npm version patch
git tag "$(cat package.json | jq -r '.version')" -m "[release] planetary-defence-$(cat package.json | jq -r '.version')"
git push origin "$(cat package.json | jq -r '.version')"
echo "VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
echo "MAJOR=$(cat package.json | jq -r '.version' | cut -d "." -f 1)" >> $GITHUB_ENV
echo "MINOR=$(cat package.json | jq -r '.version' | cut -d "." -f 2)" >> $GITHUB_ENV
echo "PATCHED=$((1 + $(cat package.json | jq -r '.version' | cut -d "." -f 3) ))" >> $GITHUB_ENV
# Note :: an env var cannot be accessed from a step that defines or updates it
- name: Release 📦
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
- name: Add -SNAPSHOT 📷
run: |
jq '.version="${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCHED }}-SNAPSHOT"' package.json > /tmp/package.json
mv /tmp/package.json package.json
- name: Commit -SNAPSHOT 💾
uses: stefanzweifel/git-auto-commit-action@v4
Empty file.

0 comments on commit 151ca40

Please sign in to comment.