release.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. on:
  2. release:
  3. types: [released]
  4. name: Update binaries
  5. jobs:
  6. update-self-hosted-helm-registry:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - name: Get tag name
  10. id: tag_name
  11. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  12. env:
  13. GITHUB_TAG: ${{ github.ref }}
  14. - name: Run workflow
  15. run: gh workflow run release.yaml --repo porter-dev/porter-self-hosted -f version=${{steps.tag_name.outputs.tag}}
  16. env:
  17. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}
  18. push-docker-server-latest:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Get tag name
  22. id: tag_name
  23. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  24. env:
  25. GITHUB_TAG: ${{ github.ref }}
  26. - name: Setup docker
  27. uses: docker/login-action@v2
  28. with:
  29. username: ${{ secrets.DOCKERHUB_USERNAME }}
  30. password: ${{ secrets.DOCKERHUB_TOKEN }}
  31. - name: Pull versioned server image and push to latest
  32. run: |
  33. docker pull porter1/porter:${{steps.tag_name.outputs.tag}}
  34. docker tag porter1/porter:${{steps.tag_name.outputs.tag}} porter1/porter:latest
  35. docker push porter1/porter:latest
  36. push-docker-cli-latest:
  37. name: Build a new porter-cli docker image
  38. runs-on: ubuntu-latest
  39. steps:
  40. - name: Get tag name
  41. id: tag_name
  42. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  43. env:
  44. GITHUB_TAG: ${{ github.ref }}
  45. - name: Configure AWS credentials
  46. uses: aws-actions/configure-aws-credentials@v1-node16
  47. with:
  48. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  49. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  50. aws-region: us-east-2
  51. - name: Login to ECR public
  52. id: login-ecr
  53. run: |
  54. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  55. - name: Login to GHCR
  56. id: login-ghcr
  57. run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
  58. - name: Pull versioned CLI image and push to latest
  59. run: |
  60. docker pull public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
  61. docker tag public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}} public.ecr.aws/o1j4x7p4/porter-cli:latest
  62. docker push public.ecr.aws/o1j4x7p4/porter-cli:latest
  63. docker pull ghcr.io/porter-dev/porter/porter-cli:${{steps.tag_name.outputs.tag}}
  64. docker tag ghcr.io/porter-dev/porter/porter-cli:${{steps.tag_name.outputs.tag}} ghcr.io/porter-dev/porter/porter-cli:latest
  65. docker push ghcr.io/porter-dev/porter/porter-cli:latest
  66. update-homebrew-repo:
  67. name: Update the Homebrew repo with the new CLI version
  68. runs-on: ubuntu-latest
  69. steps:
  70. - name: Get tag name
  71. id: tag_name
  72. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  73. env:
  74. GITHUB_TAG: ${{ github.ref }}
  75. - name: Create and commit porter.rb file
  76. run: |
  77. version=${{steps.tag_name.outputs.tag}}
  78. name=porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  79. curl -L https://github.com/porter-dev/porter/releases/download/${version}/porter_${version}_Darwin_x86_64.zip --output $name
  80. sha=$(cat porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip | openssl sha256 | sed 's/(stdin)= //g')
  81. sha=${sha#"SHA256"}
  82. cat >porter.rb <<EOL
  83. class Porter < Formula
  84. homepage "https://porter.run"
  85. version "${{steps.tag_name.outputs.tag}}"
  86. on_macos do
  87. url "https://github.com/porter-dev/porter/releases/download/${{steps.tag_name.outputs.tag}}/porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip"
  88. sha256 "$sha"
  89. def install
  90. bin.install "porter"
  91. end
  92. end
  93. end
  94. EOL
  95. - name: Add and commit porter.rb file
  96. run: |
  97. git clone https://portersupport:${{ secrets.HOMEBREW_GITHUB_TOKEN }}@github.com/porter-dev/homebrew-porter
  98. cd homebrew-porter
  99. git config user.name "Update Bot"
  100. git config user.email "support@porter.run"
  101. mv ../porter.rb ./Formula/porter.rb
  102. git add Formula
  103. git commit -m "Update to version ${{steps.tag_name.outputs.tag}}"
  104. git push origin main