Skip to content

Commit

Permalink
feat: adding release on main and develop branches for release-it cont…
Browse files Browse the repository at this point in the history
…ainerized

#5
  • Loading branch information
juancarlosjr97 committed Feb 11, 2024
1 parent fe9a588 commit 49ae0cf
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Release
on:
push:
branches: ["main", "develop"]

jobs:
release_options:
runs-on: ubuntu-latest
outputs:
release_options: ${{ steps.release_options.outputs.release_options }}
steps:
- id: release_options
name: Release options
run: |
release_options="--git.tagExclude='*[-]*'"
branch=$(echo ${{ github.ref }} | awk -F'/' '{print $NF}')
if [ -n "$branch" ] && [ "$branch" = "develop" ]; then
release_options="--preRelease=beta"
fi
echo "release_options=$release_options" >> "$GITHUB_OUTPUT"
release:
runs-on: ubuntu-latest
needs: release_options
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build the Image
run: docker build --tag ghcr.io/${{ github.repository }}:${{ github.sha }} .
- name: Running release
run: |
docker run \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
-e GIT_DIRECTORY="/app" \
-e GIT_EMAIL=${GIT_EMAIL} \
-e GIT_USERNAME="${GIT_USERNAME}" \
-e GPG_PRIVATE_KEY="${GPG_PRIVATE_KEY}" \
-e GPG_PRIVATE_KEY_ID="${GPG_PRIVATE_KEY_ID}" \
-e RELEASE_IT_PLUGINS="@release-it/conventional-changelog@latest,@release-it/bumper@latest" \
-e SSH_PRIVATE_KEY_FILE="${SSH_PRIVATE_KEY_FILE}" \
-u root \
-v $PWD:/app \
ghcr.io/${{ github.repository }}:${{ github.sha }} \
release-it --ci ${{needs.release_options.outputs.release_options}}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_GITHUB_TOKEN }}
GIT_EMAIL: ${{ vars.GIT_EMAIL }}
GIT_USERNAME: ${{ vars.GIT_USERNAME }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }}
SSH_PRIVATE_KEY_FILE: ${{ secrets.SSH_PRIVATE_KEY_FILE }}

0 comments on commit 49ae0cf

Please sign in to comment.