Skip to content

Use a git token for uploading assets #9

Use a git token for uploading assets

Use a git token for uploading assets #9

Workflow file for this run

name: Create Release
on:
push:
tags:
- v*.*.* # Triggers the workflow on version tags like v1.0.0
permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all # Required for creating a release
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install "poetry==1.7.1"
poetry config virtualenvs.create false
poetry install --no-cache
poetry install --only-root --no-interaction --no-ansi
- name: Build the package
run: poetry build
- name: Extract version
id: get_version
run: echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }} # Use the tag that triggered the workflow
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Wheel Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/gcf_data_mapper-${{ env.VERSION }}-py3-none-any.whl
asset_name: gcf_data_mapper-${{ env.VERSION }}-py3-none-any.whl
asset_content_type: application/zip
- name: Upload Source Distribution Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/gcf_data_mapper-${{ env.VERSION }}.tar.gz
asset_name: gcf_data_mapper-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip