publish-packages.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Publish to packages.smallstep.com
  2. # Independently publish packages to Red Hat (RPM) and Debian (DEB) repositories
  3. # without running a full release. Downloads packages from GitHub releases,
  4. # uploads to GCS, and imports to Artifact Registry.
  5. #
  6. # Usage (CLI):
  7. # gh workflow run publish-packages.yml -f tag=v0.28.0
  8. on:
  9. workflow_dispatch:
  10. inputs:
  11. tag:
  12. description: 'Git tag to publish (e.g., v0.28.0)'
  13. required: true
  14. type: string
  15. jobs:
  16. publish:
  17. runs-on: ubuntu-latest
  18. permissions:
  19. id-token: write
  20. contents: read
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
  24. with:
  25. ref: ${{ inputs.tag }}
  26. fetch-depth: 0
  27. - name: Extract version
  28. id: version
  29. run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
  30. env:
  31. TAG: ${{ inputs.tag }}
  32. - name: Is Pre-release
  33. id: is_prerelease
  34. run: |
  35. if [[ "$TAG" == *"-rc"* ]]; then
  36. echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
  37. else
  38. echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
  39. fi
  40. env:
  41. TAG: ${{ inputs.tag }}
  42. - name: Authenticate to Google Cloud
  43. uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
  44. with:
  45. workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WORKLOAD_IDENTITY_PROVIDER }}
  46. service_account: ${{ secrets.GOOGLE_CLOUD_GITHUB_SERVICE_ACCOUNT }}
  47. - name: Set up Cloud SDK
  48. uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1
  49. with:
  50. project_id: ${{ secrets.GOOGLE_CLOUD_PACKAGES_PROJECT_ID }}
  51. - name: Download packages from GitHub release
  52. run: |
  53. mkdir -p dist
  54. gh release download "$TAG" --pattern "*${VERSION}*.deb" --pattern "*${VERSION}*.rpm" --dir dist
  55. env:
  56. TAG: ${{ inputs.tag }}
  57. VERSION: ${{ steps.version.outputs.version }}
  58. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  59. - name: Upload packages to GCS
  60. run: |
  61. for pkg in dist/*.deb dist/*.rpm; do
  62. ./scripts/package-upload.sh "$pkg" step-ca ${{ steps.version.outputs.version }}
  63. done
  64. - name: Import packages to Artifact Registry
  65. run: ./scripts/package-repo-import.sh step-ca ${{ steps.version.outputs.version }}
  66. env:
  67. IS_PRERELEASE: ${{ steps.is_prerelease.outputs.is_prerelease }}