diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a640f3..86087bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ on: branches: - master pull_request: - branches: + branches: - master jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8295c4a..5d10591 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,73 +1,21 @@ name: Release on: - workflow_call: - inputs: - tag_name: - required: true - type: string - wheel_file: - required: true - type: string - secrets: - pypi_token: - required: true + push: + tags: + - 'v*' + +permissions: + contents: write + jobs: release: + name: Release runs-on: ubuntu-latest - env: - tag_name: ${{ inputs.tag_name }} - wheel_file: ${{ inputs.wheel_file }} steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Make a tag and create CHANGELOG.md - run: | - previous_tag=$(git -c 'versionsort.suffix=-' \ - ls-remote --exit-code --refs --sort='version:refname' --tags origin '*.*.*' \ - | tail --lines=1 \ - | cut -d '/' -f 3) - echo "Tag $tag_name" will be created - git config user.name "GitHub Actions Bot" - git config user.email "<>" - git tag -a $tag_name -m "Updated by Github workflow" - - echo "Change Log" > CHANGELOG.md - echo "-----------------" >> CHANGELOG.md - echo "All the commits since the last tag are as follows:" >> CHANGELOG.md - git log --pretty=oneline $previous_tag...$tag_name >> CHANGELOG.md - git push origin $tag_name - - - - name: Download dist artifact - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.wheel_file }} - - - name: Place artifacts - run: | - mkdir dist/ - mv $wheel_file dist/$wheel_file - - # loads contents of the dist/ folder into PyPI - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.pypi_token }} - verbose: true - - - name: Create Github Release - id: create-release - uses: actions/create-release@v1 + - name: Create release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ inputs.tag_name }} - release_name: Release ${{ inputs.tag_name }} - draft: false - prerelease: false - body_path: ./CHANGELOG.md - \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" --repo="$GITHUB_REPOSITORY" --title "release $TAG" --notes "release $TAG" --target $TAG diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index fbe2345..1f70563 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -14,7 +14,7 @@ on: description: "wheel file name" value: ${{ jobs.test-and-build.outputs.wheel_file }} env: - PIPELINE_POETRY: '1.4.0' + PIPELINE_POETRY: '1.4.0' jobs: test-and-build: @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@v4 with: python-version: '3.11' - name: Poetry Installation and configure @@ -42,7 +42,7 @@ jobs: - name: Install dependencies run: | - poetry install + poetry install - name: Run pytests run: | @@ -55,8 +55,8 @@ jobs: cv aggregate test/aggregate_example.toml \ cvcreator/templates/example.toml \ cvcreator/templates/example.toml - python -m cvcreator --latex cvcreator/templates/example.toml output.tex - + python -m cvcreator --latex cvcreator/templates/example.toml output.tex + - name: Check Package Release id: pkg-version run: | @@ -73,7 +73,7 @@ jobs: echo "skip_release=YES" >> $GITHUB_OUTPUT fi - - name: Make a New Wheel file + - name: Make a New Wheel file id: wheel if: ${{ steps.pkg-version.outputs.skip_release == 'NO' }} run: | @@ -88,8 +88,3 @@ jobs: path: dist retention-days: 1 - - - - -