Skip to content

Commit

Permalink
chore: use github api to fetch current tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nkylstad committed Nov 8, 2024
1 parent 360b0b8 commit 797775a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
16 changes: 8 additions & 8 deletions .github/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ while [[ $# -gt 0 ]]; do
esac
done

CURRENT_VERSION=$(git describe --abbrev=0 --tags 2>/dev/null)
CURRENT_VERSION=$(curl -s https://api.github.com/repos/Altinn/altinn-studio/releases/latest | jq -r .tag_name)
CURRENT_VERSION_PARTS=(${CURRENT_VERSION//./ })
FIRST_PART=${CURRENT_VERSION_PARTS[0]:1}
SECOND_PART=${CURRENT_VERSION_PARTS[1]}
Expand All @@ -54,11 +54,11 @@ echo "New git tag: $NEW_VERSION"
echo "Draft: $DRAFT"

# Create the release
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/altinn/altinn-studio/releases \
-d "{\"tag_name\":\"$NEW_VERSION\",\"name\":\"$NEW_VERSION\",\"draft\":$DRAFT,\"prerelease\":false,\"generate_release_notes\":true}"
# curl -L \
# -X POST \
# -H "Accept: application/vnd.github+json" \
# -H "Authorization: Bearer ${GITHUB_TOKEN}" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# https://api.github.com/repos/altinn/altinn-studio/releases \
# -d "{\"tag_name\":\"$NEW_VERSION\",\"name\":\"$NEW_VERSION\",\"draft\":$DRAFT,\"prerelease\":false,\"generate_release_notes\":true}"

11 changes: 7 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Generate release for Altinn Studio
on:
schedule:
# run every friday at 14:45
- cron: '45 14 * * 5'
# schedule:
# # run every friday at 14:30 UTC (15:30 Oslo time)
# - cron: '30 14 * * 5'
push:
branches:
- master

workflow_dispatch:
inputs:
Expand All @@ -29,4 +32,4 @@ jobs:
run: |
bash .github/scripts/release.sh \
--github-token ${{ secrets.GITHUB_TOKEN }} \
--draft ${{ github.event.inputs.draft || false }} # cron job will always be a full release
--draft ${{ github.event.inputs.draft || true }} # cron job will always be a full release

0 comments on commit 797775a

Please sign in to comment.