|
| 1 | +--- |
| 2 | +name: Release |
| 3 | + |
| 4 | +on: |
| 5 | + release: |
| 6 | + types: [created] |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + build: |
| 11 | + name: Build distribution |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 16 | + |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 |
| 19 | + with: |
| 20 | + python-version: 3.12 |
| 21 | + |
| 22 | + - name: Build package using ros_release_python |
| 23 | + run: | |
| 24 | + # Create a temporary directory for ros_release_python |
| 25 | + TEMP_DIR=$(mktemp -d) |
| 26 | + cd $TEMP_DIR |
| 27 | +
|
| 28 | + # Clone the ros_release_python repository |
| 29 | + git clone https://github.com/ros-infrastructure/ros_release_python.git |
| 30 | +
|
| 31 | + # Build the docker image |
| 32 | + cd ros_release_python |
| 33 | + docker build -t rrp . |
| 34 | +
|
| 35 | + # Get the repository name |
| 36 | + REPO_NAME=$(basename $GITHUB_REPOSITORY) |
| 37 | +
|
| 38 | + # Run the docker container to build the package |
| 39 | + docker run --rm \ |
| 40 | + -v "$GITHUB_WORKSPACE:/projects/$REPO_NAME" \ |
| 41 | + -v "$(pwd):/ros_release_python" \ |
| 42 | + -w "/projects/$REPO_NAME" \ |
| 43 | + rrp \ |
| 44 | + bash -c "/ros_release_python/scripts/ros_release_python pip" |
| 45 | +
|
| 46 | + - name: Upload assets to release |
| 47 | + run: | |
| 48 | + gh release upload ${{ github.event.release.tag_name }} dist/* |
| 49 | + env: |
| 50 | + GH_TOKEN: ${{ github.token }} |
| 51 | + |
| 52 | + - name: Store the distribution packages |
| 53 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 54 | + with: |
| 55 | + name: python-package-distributions |
| 56 | + path: dist/ |
| 57 | + |
| 58 | + publish-to-pypi: |
| 59 | + name: Publish Python distribution to PyPI |
| 60 | + needs: |
| 61 | + - build |
| 62 | + runs-on: ubuntu-latest |
| 63 | + environment: |
| 64 | + name: pypi |
| 65 | + url: https://pypi.org/p/vcs2l |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Download all the dists |
| 71 | + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce03 # v5.0.0 |
| 72 | + with: |
| 73 | + name: python-package-distributions |
| 74 | + path: dist/ |
| 75 | + - name: Publish distribution to PyPI |
| 76 | + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 |
0 commit comments