Skip to content

Commit

Permalink
Adding more tags to releases
Browse files Browse the repository at this point in the history
  • Loading branch information
pgoslatara committed Jul 10, 2024
1 parent 702cb6f commit cf8e7ac
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions .github/workflows/release_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
if: github.actor != 'pgoslatara'
run: exit 1

- name: Only run from `main`
if: github.ref_name != github.event.repository.default_branch
run: exit 1
# - name: Only run from `main`
# if: github.ref_name != github.event.repository.default_branch
# run: exit 1

- uses: actions/checkout@v4

Expand Down Expand Up @@ -70,22 +70,44 @@
- name: Save version to env var
id: version
run: echo "version=$(poetry version --short)" >> $GITHUB_OUTPUT
run: |
echo "version=$(poetry version --short)" >> $GITHUB_OUTPUT
echo "major=$(echo $(poetry version --short | cut -d '.' -f 1))" >> $GITHUB_OUTPUT
echo "minor=$(echo $(poetry version --short | cut -d '.' -f 2))" >> $GITHUB_OUTPUT
echo "patch=$(echo $(poetry version --short | cut -d '.' -f 3))" >> $GITHUB_OUTPUT
- name: Determine if prerelease flag is necessary
run: |
[ "${{ inputs.version_bump_type }}" = "prerelease" ] && export PRERELEASE="--prerelease" || export PRERELEASE="--latest"
echo "PRERELEASE: $PRERELEASE"
echo PRERELEASE=$PRERELEASE >> "$GITHUB_ENV"
- name: Tag commit and push
run: |
git config --globa user.email "[email protected]"
git config --global user.email "[email protected]"
git config --global user.name "github-actions[bot]"
git tag -a ${{ steps.version.outputs.version }} -m "${{ steps.version.outputs.version }}"
git push origin "${{ steps.version.outputs.version }}"
git tag \
-a v${{ steps.version.outputs.version }} \
-m "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
git tag \
-a v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }} \
-m "v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}"
git push origin "v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}"
git tag \
-a v${{ steps.version.outputs.major }} \
-m "v${{ steps.version.outputs.major }}"
git push origin "v${{ steps.version.outputs.major }}"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.version.outputs.version }}
type=raw,value=v${{ steps.version.outputs.version }}
type=raw,value=v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}
type=raw,value=v${{ steps.version.outputs.major }}
type=raw,value=${{ github.sha }}
- name: Set up Docker Buildx
Expand Down Expand Up @@ -117,20 +139,14 @@
push: true
tags: ${{ steps.meta.outputs.tags }}

- name: Determine if prerelease flag is necessary
run: |
[ "${{ inputs.version_bump_type }}" = "prerelease" ] && export PRERELEASE="--prerelease" || export PRERELEASE="--latest"
echo "PRERELEASE: $PRERELEASE"
echo PRERELEASE=$PRERELEASE >> "$GITHUB_ENV"
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ steps.version.outputs.version }} \
gh release create v${{ steps.version.outputs.version }} \
--generate-notes \
--repo ${{ github.repository }} \
--target main \
--title '${{ steps.version.outputs.version }}' \
--title 'v${{ steps.version.outputs.version }}' \
$PRELEASE \
--verify-tag

0 comments on commit cf8e7ac

Please sign in to comment.