-
Notifications
You must be signed in to change notification settings - Fork 4
47 lines (45 loc) · 2.25 KB
/
create-release-tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Create release
on:
workflow_dispatch:
jobs:
build:
name: Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract branch name
run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- uses: actions/setup-python@v4
with:
python-version: ${{ vars.CI_PYTHON_VERSION }}
- uses: snok/install-poetry@v1
with:
version: ${{ vars.CI_POETRY_VERSION }}
- name: Generate tag
id: version-tag
# run: echo "CALVER=$(date +%y.%m.%d).${{ github.run_number }}" >> "$GITHUB_OUTPUT"
run: echo "CALVER=$(date +%y.%m.%d).$(git rev-list main --count)" >> "$GITHUB_OUTPUT"
- name: Update version and push
run: |
git checkout -b "release/v${{ steps.version-tag.outputs.CALVER }}"
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
poetry version "${{ steps.version-tag.outputs.CALVER }}"
git add pyproject.toml
git commit -m "Release ${{ steps.version-tag.outputs.CALVER }}"
git push --set-upstream origin "release/v${{ steps.version-tag.outputs.CALVER }}"
git tag v${{ steps.version-tag.outputs.CALVER }} -m "Version ${{ steps.version-tag.outputs.CALVER }}"
git push origin --tags
- name: Create pull request
run: gh pr create -B ${{ steps.extract_branch.outputs.BRANCH }} -H "release/v${{ steps.version-tag.outputs.CALVER }}" --title "Version ${{ steps.version-tag.outputs.CALVER }}" --body "Created by Github action https://github.com/nationalarchives/ds-wagtail/actions/runs/${{ github.run_id }}" --no-maintainer-edit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Merge the pull request
# run: gh pr merge "release/v${{ steps.version-tag.outputs.CALVER }}" --admin --merge
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
run: gh release create "v${{ steps.version-tag.outputs.CALVER }}" --title "${{ steps.version-tag.outputs.CALVER }}" --draft --generate-notes --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}