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