Test release CI within PR #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# REFERENCE | |
# | |
# pushing commits with GithubActions: | |
# - https://openedx.atlassian.net/wiki/spaces/AC/pages/3378348233/Writing+a+GitHub+Action+that+pushes+commits | |
# | |
# publishing to PyPI: | |
# - https://github.com/marketplace/actions/pypi-publish | |
# | |
# publishing a GitHubRelease: | |
# - https://github.com/marketplace/actions/gh-release | |
name: publish-and-release | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
required: true | |
description: "Release tag (e.g. 3.2.1)" | |
release-again: | |
required: true | |
description: "Just checking." | |
pull_request: # for iteractive fixing CI errors with a PR (without having to push to master to see them) | |
env: | |
# NEW_VERSION: {{ github.event.input.release }} | |
# NEW_VERSION2: {{ github.event.input.release-again }} | |
NEW_VERSION: 3.2.5 | |
NEW_VERSION2: 3.2.5 | |
jobs: | |
build-and-commit: | |
name: "Build dist and create release commit" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check workflow input" | |
run: | | |
[[ $NEW_VERSION == $NEW_VERSION2 ]] || exit 1 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: "1. Prepare build/release environemnt" | |
run: | | |
pip install --upgrade pip | |
pip install --user python-minifier wheel setuptools semver git-changelog | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: "2. Bump version-files and update changelog" | |
run: | | |
.github/scripts/01-bump-and-update-changelog.sh $NEW_VERSION | |
git diff # check changes | |
- name: "3. Build and Check distribution" | |
run: | | |
make dist | |
.github/scripts/02-build-distribution.sh | |
- name: "4. Save dist for publishing" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist-folder | |
path: dist | |
if-no-files-found: "error" | |
- name: "5. Create release-commit" | |
run: | | |
# .github/scripts/create-release-commit.sh {{ github.event.input.release}} | |
.github/scripts/03-create-release-commit.sh $NEW_VERSION | |
- name: "6. Push commit to master" | |
run: | | |
echo "Pushing commit to master" | |
git show HEAD | |
# git remote set-url origin https://x-access-token:${{ github.token }}@github.com/${{ github.repository }} | |
# git push | |
pypi-publish: | |
name: "Upload release to PyPI" | |
needs: build-and-commit | |
runs-on: ubuntu-latest | |
# environment: | |
# name: pypi | |
# url: https://pypi.org/p/dynaconf | |
# permissions: | |
# id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Get distribution | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist-folder | |
path: dist | |
- name: Test publish | |
run: | | |
tree dist | |
# - name: Publish package distributions to PyPI | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
github-release: | |
name: Create GitHub Release | |
needs: pypi-publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
- name: Install git-changelog | |
run: pip install git-changelog | |
- name: Prepare release notes | |
run: | | |
git-changelog --release-notes > release-notes.md | |
echo "Release notes being used:" | |
cat release-notes.md | |
# - name: Create GitHub release | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# body_path: release-notes.md |