Skip to content

Commit

Permalink
Update the release to publish a release archive.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705578400
  • Loading branch information
michaelreneer authored and copybara-github committed Dec 13, 2024
1 parent e58b1fe commit 20493d4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 37 deletions.
82 changes: 57 additions & 25 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,93 @@ name: Release
on: # yamllint disable-line rule:truthy

# postsubmit
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# DO_NOT_SUBMIT
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'

pull_request:
branches:
- main

jobs:

test-package:
name: Test Package
uses: ./.github/workflows/test_package.yaml

publish-to-pypi:
name: Publish to PyPI
needs: [test-package]
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: pypi
url: https://pypi.org/p/federated-language
permissions:
id-token: write # Required for trusted publishing.
steps:
# publish-to-pypi:
# name: Publish to PyPI
# needs: [test-package]
# runs-on: ubuntu-latest
# timeout-minutes: 5
# environment:
# name: pypi
# url: https://pypi.org/p/federated-language
# permissions:
# id-token: write # Required for trusted publishing.
# steps:

- name: Download package
uses: actions/[email protected]
with:
name: python-package-distributions
path: dist/
# - name: Download package
# uses: actions/[email protected]
# with:
# name: python-package-distributions
# path: dist/

- name: Publish
uses: pypa/[email protected]
# - name: Publish
# uses: pypa/[email protected]

release-to-github:
name: Release to GitHub
needs: [publish-to-pypi]
needs: [test-package]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write # Required for creating GitHub Releases.
id-token: write # Requried for sigstore.
steps:

- name: Checkout repository
uses: actions/[email protected]

- name: Download package
uses: actions/[email protected]
with:
name: python-package-distributions
path: dist/

- name: gh-action-sigstore-python
- name: Create archive
run: |
tag="${{ github.ref_name }}"
echo "${tag}"
version="${tag#v}"
echo "${version}"
ls -la "dist"
pwd
git tag --list
git archive \
--prefix="federated-language-0.1.0-B" \
--output="dist/federated-language-0.1.0-B.tar.gz" \
'v0.1.0'
ls -la "dist"
# - name: Download release archive
# run: |
# curl \
# --output dist/federated-language-0.1.0.tar.gz \
# https://github.com/google-parfait/federated-language/archive/v0.1.0.tar.gz

- name: Create Sigstore signatures
uses: sigstore/[email protected]
with:
inputs: |
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
Expand All @@ -81,7 +113,7 @@ jobs:
--repo '${{ github.repository }}' \
--draft
- name: Upload artifacts to GitHub Release
- name: Upload artifacts to GitHub release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/test_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ name: Test Package
on: # yamllint disable-line rule:truthy

# presubmit
pull_request:
branches:
- main
# DO_NOT_SUBMIT
# pull_request:
# branches:
# - main

# manual
workflow_dispatch:
Expand Down Expand Up @@ -87,12 +88,7 @@ jobs:
name: python-package-distributions
path: dist/

- name: Install dependencies
run: |
pip install --upgrade pip
- name: Test package
run: |
package="$(ls "${{ github.workspace }}/dist/"*".whl" | head -n1)"
pip install --upgrade "${package}"
pip install --upgrade "dist/"*".whl"
python -I -c "import federated_language; print(federated_language.__version__)"
7 changes: 4 additions & 3 deletions .github/workflows/test_project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ name: Test Project
on: # yamllint disable-line rule:truthy

# presubmit
pull_request:
branches:
- main
# DO_NOT_SUBMIT
# pull_request:
# branches:
# - main

# manual
workflow_dispatch:
Expand Down

0 comments on commit 20493d4

Please sign in to comment.