release.yaml 3.6 KB

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