diff --git a/.github/workflows/autorelease-default-env.sh b/.github/workflows/autorelease-default-env.sh index 064478c..f15ac5c 100644 --- a/.github/workflows/autorelease-default-env.sh +++ b/.github/workflows/autorelease-default-env.sh @@ -1,4 +1,6 @@ -INSTALL_AUTORELEASE="python -m pip install autorelease==0.3.0" +# Vendored from Autorelease 0.3.1 +# Update by updating Autorelease and running `autorelease vendor actions` +INSTALL_AUTORELEASE="python -m pip install autorelease==0.3.1" if [ -f autorelease-env.sh ]; then source autorelease-env.sh fi diff --git a/.github/workflows/autorelease-deploy.yml b/.github/workflows/autorelease-deploy.yml index 5192236..5b91173 100644 --- a/.github/workflows/autorelease-deploy.yml +++ b/.github/workflows/autorelease-deploy.yml @@ -1,4 +1,6 @@ -name: Autorelease +# Vendored from Autorelease 0.3.1 +# Update by updating Autorelease and running `autorelease vendor actions` +name: "Autorelease Deploy" on: release: types: [published] diff --git a/.github/workflows/autorelease-gh-rel.yml b/.github/workflows/autorelease-gh-rel.yml index 32cd720..4d11807 100644 --- a/.github/workflows/autorelease-gh-rel.yml +++ b/.github/workflows/autorelease-gh-rel.yml @@ -1,7 +1,10 @@ -name: Autorelease +# Vendored from Autorelease 0.3.1 +# Update by updating Autorelease and running `autorelease vendor actions` +name: "Autorelease Release" on: push: branches: + # TODO: this should come from yaml conf - stable jobs: @@ -31,3 +34,4 @@ jobs: autorelease-release --project $PROJECT --version $VERSION --token $AUTORELEASE_TOKEN env: AUTORELEASE_TOKEN: ${{ secrets.AUTORELEASE_TOKEN }} + name: "Cut release" diff --git a/.github/workflows/autorelease-prep.yml b/.github/workflows/autorelease-prep.yml index ae965dc..1f01841 100644 --- a/.github/workflows/autorelease-prep.yml +++ b/.github/workflows/autorelease-prep.yml @@ -1,9 +1,10 @@ -# File vencdored from Autorelease; specific version information should be in -# the INSTALL_AUTORELEASE variable in autorelease-default-env.sh -name: "Autorelease" +# Vendored from Autorelease 0.3.1 +# Update by updating Autorelease and running `autorelease vendor actions` +name: "Autorelease testpypi" on: pull_request: branches: + # TODO: this should come from yaml conf - stable defaults: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 36c8411..ca7bbb9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -2,11 +2,11 @@ name: "Unit tests" on: pull_request: branches: - - master + - main - stable push: branches: - - master + - main tags: - "v*" schedule: diff --git a/autorelease-travis.yml b/autorelease-travis.yml index cb318e4..82eac79 100644 --- a/autorelease-travis.yml +++ b/autorelease-travis.yml @@ -1,4 +1,4 @@ -# AUTORELEASE v0.3.0 +# AUTORELEASE v0.3.1 # for nonrelease, use @master # for release, use v${VERSION}, e.g., v1.0.0 stages: @@ -9,7 +9,7 @@ stages: - deploy pypi import: - - dwhswenson/autorelease:travis_stages/deploy_testpypi.yml@v0.3.0 - - dwhswenson/autorelease:travis_stages/test_testpypi.yml@v0.3.0 - - dwhswenson/autorelease:travis_stages/cut_release.yml@v0.3.0 - - dwhswenson/autorelease:travis_stages/deploy_pypi.yml@v0.3.0 + - dwhswenson/autorelease:travis_stages/deploy_testpypi.yml@v0.3.1 + - dwhswenson/autorelease:travis_stages/test_testpypi.yml@v0.3.1 + - dwhswenson/autorelease:travis_stages/cut_release.yml@v0.3.1 + - dwhswenson/autorelease:travis_stages/deploy_pypi.yml@v0.3.1 diff --git a/autorelease/gh_actions_stages/autorelease-default-env.sh b/autorelease/gh_actions_stages/autorelease-default-env.sh index 064478c..2b62a7e 100644 --- a/autorelease/gh_actions_stages/autorelease-default-env.sh +++ b/autorelease/gh_actions_stages/autorelease-default-env.sh @@ -1,4 +1,6 @@ -INSTALL_AUTORELEASE="python -m pip install autorelease==0.3.0" +# Vendored from Autorelease $VERSION +# Update by updating Autorelease and running `autorelease vendor actions` +INSTALL_AUTORELEASE="python -m pip install autorelease==$VERSION" if [ -f autorelease-env.sh ]; then source autorelease-env.sh fi diff --git a/autorelease/gh_actions_stages/autorelease-deploy.yml b/autorelease/gh_actions_stages/autorelease-deploy.yml index 5192236..9a92321 100644 --- a/autorelease/gh_actions_stages/autorelease-deploy.yml +++ b/autorelease/gh_actions_stages/autorelease-deploy.yml @@ -1,4 +1,6 @@ -name: Autorelease +# Vendored from Autorelease $VERSION +# Update by updating Autorelease and running `autorelease vendor actions` +name: "Autorelease Deploy" on: release: types: [published] @@ -15,12 +17,12 @@ jobs: - run: | # TODO: move this to an action source ./.github/workflows/autorelease-default-env.sh if [ -f "autorelease-env.sh" ]; then - cat autorelease-env.sh >> $GITHUB_ENV + cat autorelease-env.sh >> $$GITHUB_ENV fi if [ -f "./.autorelease/install-autorelease" ]; then source ./.autorelease/install-autorelease else - eval $INSTALL_AUTORELEASE + eval $$INSTALL_AUTORELEASE fi name: "Install autorelease" - run: | @@ -32,6 +34,6 @@ jobs: name: "Build and check package" - uses: pypa/gh-action-pypi-publish@master with: - password: ${{ secrets.pypi_password }} + password: $${{ secrets.pypi_password }} name: "Deploy to pypi" diff --git a/autorelease/gh_actions_stages/autorelease-gh-rel.yml b/autorelease/gh_actions_stages/autorelease-gh-rel.yml index 32cd720..ba8105b 100644 --- a/autorelease/gh_actions_stages/autorelease-gh-rel.yml +++ b/autorelease/gh_actions_stages/autorelease-gh-rel.yml @@ -1,7 +1,10 @@ -name: Autorelease +# Vendored from Autorelease $VERSION +# Update by updating Autorelease and running `autorelease vendor actions` +name: "Autorelease Release" on: push: branches: + # TODO: this should come from yaml conf - stable jobs: @@ -16,18 +19,19 @@ jobs: - run: | # TODO: move this to an action source ./.github/workflows/autorelease-default-env.sh if [ -f "autorelease-env.sh" ]; then - cat autorelease-env.sh >> $GITHUB_ENV + cat autorelease-env.sh >> $$GITHUB_ENV fi if [ -f "./.autorelease/install-autorelease" ]; then source ./.autorelease/install-autorelease else - eval $INSTALL_AUTORELEASE + eval $$INSTALL_AUTORELEASE fi name: "Install autorelease" - run: | VERSION=`python setup.py --version` PROJECT=`python setup.py --name` - echo $PROJECT $VERSION - autorelease-release --project $PROJECT --version $VERSION --token $AUTORELEASE_TOKEN + echo $$PROJECT $$VERSION + autorelease-release --project $$PROJECT --version $$VERSION --token $$AUTORELEASE_TOKEN env: - AUTORELEASE_TOKEN: ${{ secrets.AUTORELEASE_TOKEN }} + AUTORELEASE_TOKEN: $${{ secrets.AUTORELEASE_TOKEN }} + name: "Cut release" diff --git a/autorelease/gh_actions_stages/autorelease-prep.yml b/autorelease/gh_actions_stages/autorelease-prep.yml index ae965dc..1966ed3 100644 --- a/autorelease/gh_actions_stages/autorelease-prep.yml +++ b/autorelease/gh_actions_stages/autorelease-prep.yml @@ -1,9 +1,10 @@ -# File vencdored from Autorelease; specific version information should be in -# the INSTALL_AUTORELEASE variable in autorelease-default-env.sh -name: "Autorelease" +# Vendored from Autorelease $VERSION +# Update by updating Autorelease and running `autorelease vendor actions` +name: "Autorelease testpypi" on: pull_request: branches: + # TODO: this should come from yaml conf - stable defaults: @@ -22,12 +23,12 @@ jobs: - run: | # TODO: move this to an action source ./.github/workflows/autorelease-default-env.sh if [ -f "autorelease-env.sh" ]; then - cat autorelease-env.sh >> $GITHUB_ENV + cat autorelease-env.sh >> $$GITHUB_ENV fi if [ -f "./.autorelease/install-autorelease" ]; then source ./.autorelease/install-autorelease else - eval $INSTALL_AUTORELEASE + eval $$INSTALL_AUTORELEASE fi name: "Install autorelease" - run: | @@ -43,7 +44,7 @@ jobs: name: "Build and check package" - uses: pypa/gh-action-pypi-publish@master with: - password: ${{ secrets.testpypi_password }} + password: $${{ secrets.testpypi_password }} repository_url: https://test.pypi.org/legacy/ name: "Deploy to testpypi" test_testpypi: @@ -58,12 +59,12 @@ jobs: - run: | # TODO: move this to an action source ./.github/workflows/autorelease-default-env.sh if [ -f "autorelease-env.sh" ]; then - cat autorelease-env.sh >> $GITHUB_ENV + cat autorelease-env.sh >> $$GITHUB_ENV fi if [ -f "./.autorelease/install-autorelease" ]; then source ./.autorelease/install-autorelease else - eval $INSTALL_AUTORELEASE + eval $$INSTALL_AUTORELEASE fi name: "Install autorelease" - name: "Install testpypi version" @@ -71,6 +72,6 @@ jobs: - name: "Test testpypi version" run: | if [ -f "autorelease-env.sh" ]; then - cat autorelease-env.sh >> $GITHUB_ENV + cat autorelease-env.sh >> $$GITHUB_ENV fi test-testpypi diff --git a/autorelease/release_notes.py b/autorelease/release_notes.py index 8154ed2..2726432 100644 --- a/autorelease/release_notes.py +++ b/autorelease/release_notes.py @@ -117,10 +117,12 @@ def write_pull_line(self, pull, extra_labels=None): title = pull['title'] number = str(pull['number']) author = pull['user']['login'] - out_str = "* " + title + " (#" + number + url = pull['html_url'] + pull_link = "([#" + number + "](" + url + ")" if author not in self.config['standard_contributors']: - out_str += " @" + author - out_str += ")" + pull_link += " @" + author + pull_link += ")" + out_str = "* " + title + " " + pull_link for label in extra_labels: label = label.replace(' ', '_') out_str += " #" + label @@ -139,7 +141,7 @@ def output_for_known_labels(self, pull_dict, pull_to_labels): out_str = "" for lbl in self.config['labels']: label = lbl['label'] - out_str += "\n# " + lbl['heading'] + "\n" + out_str += "\n## " + lbl['heading'] + "\n" for pull in pull_dict[label]: pull_labels = set(pull_to_labels[pull['number']]) extra_labels = pull_labels - set([label]) diff --git a/autorelease/scripts/vendor.py b/autorelease/scripts/vendor.py index 787415d..8e19a5a 100644 --- a/autorelease/scripts/vendor.py +++ b/autorelease/scripts/vendor.py @@ -1,8 +1,8 @@ -import pkg_resources +import string import pathlib -import shutil - -import click +import pkg_resources +from packaging.version import Version +import autorelease def vendor(resources, base_path, relative_target_dir): for resource in resources: @@ -12,7 +12,12 @@ def vendor(resources, base_path, relative_target_dir): target_dir.mkdir(parents=True, exist_ok=True) target_loc = base_path / relative_target_dir / name # print(f"cp {orig_loc} {target_loc}") - shutil.copy(orig_loc, target_loc) + with open(orig_loc, mode='r') as rfile: + template = string.Template(rfile.read()) + + version = Version(autorelease.version.version).base_version + with open(target_loc, mode='w') as wfile: + wfile.write(template.substitute(VERSION=version)) def vendor_actions(base_path): resources = ['autorelease-default-env.sh', 'autorelease-prep.yml', diff --git a/devtools/conda-recipe/meta.yaml b/devtools/conda-recipe/meta.yaml index bdc85ea..1fd7ded 100644 --- a/devtools/conda-recipe/meta.yaml +++ b/devtools/conda-recipe/meta.yaml @@ -1,7 +1,7 @@ package: name: autorelease # add ".dev0" for unreleased versions - version: "0.3.0" + version: "0.3.1" source: path: ../../ diff --git a/setup.cfg b/setup.cfg index 32fed74..cef1898 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = autorelease -version = 0.3.0 +version = 0.3.1 # version should end in .dev0 if this isn't to be released short_description = Tools to keep the release process clean. description = Tools to keep the release process clean.