From 795b1517cb835f958fd56613a5c723e14d3b9ece Mon Sep 17 00:00:00 2001 From: Craig <3979063+craig8@users.noreply.github.com> Date: Wed, 10 May 2023 09:14:24 -0700 Subject: [PATCH 1/3] Put make-release in the correct location --- .github/{ => workflows}/make-release.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/make-release.yml (100%) diff --git a/.github/make-release.yml b/.github/workflows/make-release.yml similarity index 100% rename from .github/make-release.yml rename to .github/workflows/make-release.yml From 756ed57c9b5cabfd399fc7b01e7af3551583a33e Mon Sep 17 00:00:00 2001 From: Craig <3979063+craig8@users.noreply.github.com> Date: Wed, 10 May 2023 09:14:52 -0700 Subject: [PATCH 2/3] Fix version number --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5fb8623..93f24f4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -46,7 +46,7 @@ jobs: - name: Set up Python ${{ matrix.python }} id: setup-python - uses: actions/setup-python@v4.6 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} From b4eb2dbf1fb75ab08d21c27accb0ae132eafcc65 Mon Sep 17 00:00:00 2001 From: C <3979063+craig8@users.noreply.github.com> Date: Thu, 11 May 2023 09:39:29 -0700 Subject: [PATCH 3/3] Update deploy-pre-release --- .github/workflows/deploy-pre-release.yml | 212 ++++++++++++----------- 1 file changed, 107 insertions(+), 105 deletions(-) diff --git a/.github/workflows/deploy-pre-release.yml b/.github/workflows/deploy-pre-release.yml index 8d47f38..633d8c0 100644 --- a/.github/workflows/deploy-pre-release.yml +++ b/.github/workflows/deploy-pre-release.yml @@ -3,7 +3,7 @@ name: Deploy Pre-Release Artifacts on: push: branches: - - develop + - develop defaults: run: @@ -12,112 +12,114 @@ defaults: env: LANG: en_US.utf-8 LC_ALL: en_US.utf-8 - PYTHON_VERSION: '3.8' - PROJECT_NAME: test-release-actions - POETRY_VERSION: 1.2.2 + PYTHON_VERSION: '3.10' jobs: bump_version: - runs-on: ubuntu-20.04 + if: github.ref_name != 'main' + environment: test_env + runs-on: ubuntu-22.04 steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - #---------------------------------------------- - # check-out repo and set-up python - #---------------------------------------------- - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python ${{ env.PYTHON_VERSION }} - id: setup-python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - #---------------------------------------------- - # ----- install & configure poetry ----- - #---------------------------------------------- - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - version: ${{ env.POETRY_VERSION }} - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - #---------------------------------------------- - # load cached venv if cache exists - #---------------------------------------------- - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - #---------------------------------------------- - # install dependencies if cache does not exist - #---------------------------------------------- - - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root - - #---------------------------------------------- - # install your root project, if required - #---------------------------------------------- - - name: Install library - run: | - poetry install --no-interaction - - #---------------------------------------------- - # bump version number for patch - #---------------------------------------------- - - name: Bump Version - run: | - # current_tag is the last tagged release in the repository. - # From there we need to remove the v from the beginning of the tag. - if ! $(git tag -l "v*" = ''); then - # uses -V which is version sort to keep it monotonically increasing. - current_tag=$(git tag -l "v*" | sort --reverse -V |sed -n 1p) - else - current_tag=v0.1.0 - fi - - current_tag=${current_tag#?} - - # current_tag is now the version we want to set our poetry version so - # that we can bump the version - poetry version ${current_tag} - poetry version prerelease --no-interaction - - # Finally because we want to be able to use the variable in later - # steps we set a NEW_TAG environmental variable - NEW_TAG=v$(poetry version --short) - echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV - - #--------------------------------------------------------------- - # create build artifacts to be included as part of release - #--------------------------------------------------------------- - - name: Create build artifacts - run: | - poetry build -vvv - - uses: ncipollo/release-action@v1 - with: - artifacts: dist/*.gz,dist/*.whl - artifactErrorsFailBuild: true - generateReleaseNotes: true - commit: ${{ github.ref }} - prerelease: true - tag: ${{ env.NEW_TAG }} - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish pre-release to pypi - if: github.repository == 'eclipse-volttron/volttron-lib-base-driver' - run: | - poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} - poetry publish + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + + #---------------------------------------------- + # check-out repo and set-up python + #---------------------------------------------- + - name: Checkout code + uses: actions/checkout@v3.5.2 + with: + fetch-depth: 0 + + - name: Set up Python ${{ env.PYTHON_VERSION }} + id: setup-python + uses: actions/setup-python@v2 + with: + python-version: ${{ env.PYTHON_VERSION }} + + #---------------------------------------------- + # ----- install & configure poetry ----- + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1.3.3 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2.1.7 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install library + run: | + poetry install --no-interaction + + - name: Bump Version + run: | + # current_tag is the last tagged release in the repository. From there + # we need to remove the v from the beginning of the tag. + echo "Bump rule is prerelease" + if ! $(git tag -l "v*" = ''); then + # uses -V which is version sort to keep it monotonically increasing. + current_tag=$(git tag -l "v*" | grep --invert-match '-' | sort --reverse -V | sed -n 1p) + echo "current git tag is ${current_tag}" + current_tag=${current_tag#?} + # current_tag is now the version we want to set our poetry version so + # that we can bump the version + poetry version ${current_tag} + poetry version prerelease --no-interaction + + else + # very first release. start with inputs.first-release-version + echo "First release. Setting tag as v0.0.1rc0" + current_tag=v0.0.1rc0 + poetry version ${current_tag} + fi + + NEW_TAG=v$(poetry version --short) + + # Finally because we want to be able to use the variable in later + # steps we set a NEW_TAG environmental variable + echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV + + #--------------------------------------------------------------- + # create build artifacts to be included as part of release + #--------------------------------------------------------------- + - name: Create build artifacts + run: | + poetry build -vvv + + - uses: ncipollo/release-action@v1.12.0 + with: + artifacts: "dist/*.gz,dist/*.whl" + artifactErrorsFailBuild: true + generateReleaseNotes: true + commit: ${{ github.ref }} + prerelease: true + tag: ${{ env.NEW_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish pre-release to pypi + if: github.repository_owner == 'eclipse-volttron' + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish