prerelease.yaml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. on:
  2. push:
  3. tags:
  4. - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
  5. name: Create prerelease w/ binaries and docker image
  6. jobs:
  7. build-push-porter:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Get tag name
  11. id: tag_name
  12. run: |
  13. tag=${GITHUB_TAG/refs\/tags\//}
  14. echo ::set-output name=tag::$tag
  15. env:
  16. GITHUB_TAG: ${{ github.ref }}
  17. - name: Checkout
  18. uses: actions/checkout@v2.3.4
  19. - name: Setup docker
  20. uses: docker/login-action@v1
  21. with:
  22. username: ${{ secrets.DOCKERHUB_USERNAME }}
  23. password: ${{ secrets.DOCKERHUB_TOKEN }}
  24. - name: Write Dashboard Environment Variables
  25. run: |
  26. cat >./dashboard/.env <<EOL
  27. NODE_ENV=production
  28. APPLICATION_CHART_REPO_URL=https://charts.getporter.dev
  29. ADDON_CHART_REPO_URL=https://chart-addons.getporter.dev
  30. EOL
  31. cat ./dashboard/.env
  32. - name: Build
  33. run: |
  34. DOCKER_BUILDKIT=1 docker build . -t porter1/porter:${{steps.tag_name.outputs.tag}} -f ./ee/docker/ee.Dockerfile --build-arg version=${{steps.tag_name.outputs.tag}}
  35. - name: Push
  36. run: |
  37. docker push porter1/porter:${{steps.tag_name.outputs.tag}}
  38. - name: Configure AWS credentials
  39. uses: aws-actions/configure-aws-credentials@v1
  40. with:
  41. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  42. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  43. aws-region: us-east-2
  44. - name: Login to ECR public
  45. id: login-ecr
  46. run: |
  47. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  48. - name: Push to ECR public
  49. run: |
  50. docker tag porter1/porter:${{steps.tag_name.outputs.tag}} public.ecr.aws/o1j4x7p4/porter:${{steps.tag_name.outputs.tag}}
  51. docker push public.ecr.aws/o1j4x7p4/porter:${{steps.tag_name.outputs.tag}}
  52. build-push-provisioner:
  53. runs-on: ubuntu-latest
  54. steps:
  55. - name: Get tag name
  56. id: tag_name
  57. run: |
  58. tag=${GITHUB_TAG/refs\/tags\//}
  59. echo ::set-output name=tag::$tag
  60. env:
  61. GITHUB_TAG: ${{ github.ref }}
  62. - name: Checkout
  63. uses: actions/checkout@v2.3.4
  64. - name: Configure AWS credentials
  65. uses: aws-actions/configure-aws-credentials@v1
  66. with:
  67. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  68. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  69. aws-region: us-east-2
  70. - name: Login to ECR public
  71. id: login-ecr
  72. run: |
  73. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  74. - name: Build
  75. run: |
  76. DOCKER_BUILDKIT=1 docker build . -t public.ecr.aws/o1j4x7p4/provisioner-service:${{steps.tag_name.outputs.tag}} -f ./ee/docker/provisioner.Dockerfile
  77. - name: Push to ECR public
  78. run: |
  79. docker push public.ecr.aws/o1j4x7p4/provisioner-service:${{steps.tag_name.outputs.tag}}
  80. build-push-worker-pool:
  81. runs-on: ubuntu-latest
  82. steps:
  83. - name: Get tag name
  84. id: tag_name
  85. run: |
  86. tag=${GITHUB_TAG/refs\/tags\//}
  87. echo ::set-output name=tag::$tag
  88. env:
  89. GITHUB_TAG: ${{ github.ref }}
  90. - name: Checkout
  91. uses: actions/checkout@v2.3.4
  92. - name: Configure AWS credentials
  93. uses: aws-actions/configure-aws-credentials@v1
  94. with:
  95. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  96. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  97. aws-region: us-east-2
  98. - name: Login to ECR public
  99. id: login-ecr
  100. run: |
  101. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  102. - name: Build
  103. run: |
  104. DOCKER_BUILDKIT=1 docker build . -t public.ecr.aws/o1j4x7p4/worker-pool:${{steps.tag_name.outputs.tag}} -f ./workers/Dockerfile
  105. - name: Push to ECR public
  106. run: |
  107. docker push public.ecr.aws/o1j4x7p4/worker-pool:${{steps.tag_name.outputs.tag}}
  108. build-linux:
  109. name: Build Linux binaries
  110. runs-on: ubuntu-latest
  111. steps:
  112. - name: Get tag name
  113. id: tag_name
  114. run: |
  115. tag=${GITHUB_TAG/refs\/tags\//}
  116. echo ::set-output name=tag::$tag
  117. env:
  118. GITHUB_TAG: ${{ github.ref }}
  119. - name: Checkout code
  120. uses: actions/checkout@v2
  121. - name: Set up Go
  122. uses: actions/setup-go@v2
  123. with:
  124. go-version: 1.18
  125. - name: Write Dashboard Environment Variables
  126. run: |
  127. cat >./dashboard/.env <<EOL
  128. NODE_ENV=production
  129. APPLICATION_CHART_REPO_URL=https://charts.getporter.dev
  130. ADDON_CHART_REPO_URL=https://chart-addons.getporter.dev
  131. EOL
  132. - name: Build and zip static folder
  133. run: |
  134. mkdir -p ./release/static
  135. cd dashboard
  136. npm i --production=false --legacy-peer-deps
  137. npm run build
  138. cd ..
  139. zip --junk-paths ./release/static/static_${{steps.tag_name.outputs.tag}}.zip ./dashboard/build/*
  140. env:
  141. NODE_ENV: production
  142. - name: Build Linux binaries
  143. run: |
  144. go build -ldflags="-w -s -X 'github.com/porter-dev/porter/cli/cmd/config.Version=${{steps.tag_name.outputs.tag}}' -X 'github.com/porter-dev/porter/cli/cmd/errors.SentryDSN=${{secrets.SENTRY_DSN}}'" -a -tags cli -o ./porter ./cli &
  145. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -o ./docker-credential-porter ./cmd/docker-credential-porter/ &
  146. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -tags ee -o ./portersvr ./cmd/app/ &
  147. wait
  148. env:
  149. GOOS: linux
  150. GOARCH: amd64
  151. CGO_ENABLED: 0
  152. # Note: we have to zip all binaries before uploading them as artifacts --
  153. # without this step, the binaries will be uploaded but the file metadata will
  154. # be listed as plaintext after downloading the artifact in a later step
  155. #
  156. # TODO: investigate
  157. - name: Zip Linux binaries
  158. run: |
  159. mkdir -p ./release/linux
  160. zip --junk-paths ./release/linux/porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip ./porter
  161. zip --junk-paths ./release/linux/portersvr_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip ./portersvr
  162. zip --junk-paths ./release/linux/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip ./docker-credential-porter
  163. - name: Upload binaries
  164. uses: actions/upload-artifact@v2
  165. with:
  166. path: ./release/linux
  167. name: linux-binaries
  168. retention-days: 1
  169. - name: Upload static binaries
  170. uses: actions/upload-artifact@v2
  171. with:
  172. path: ./release/static
  173. name: static-binaries
  174. retention-days: 1
  175. build-mac:
  176. name: Build MacOS binaries
  177. runs-on: macos-11
  178. steps:
  179. - name: Get tag name
  180. id: tag_name
  181. run: |
  182. tag=${GITHUB_TAG/refs\/tags\//}
  183. echo ::set-output name=tag::$tag
  184. env:
  185. GITHUB_TAG: ${{ github.ref }}
  186. - name: Checkout code
  187. uses: actions/checkout@v2
  188. - name: Set up Go
  189. uses: actions/setup-go@v2
  190. with:
  191. go-version: 1.18
  192. - name: Write Dashboard Environment Variables
  193. run: |
  194. cat >./dashboard/.env <<EOL
  195. NODE_ENV=production
  196. APPLICATION_CHART_REPO_URL=https://charts.getporter.dev
  197. ADDON_CHART_REPO_URL=https://chart-addons.getporter.dev
  198. EOL
  199. - name: Build and Zip MacOS amd64 binaries
  200. run: |
  201. go build -ldflags="-w -s -X 'github.com/porter-dev/porter/cli/cmd/config.Version=${{steps.tag_name.outputs.tag}}' -X 'github.com/porter-dev/porter/cli/cmd/errors.SentryDSN=${{secrets.SENTRY_DSN}}'" -a -tags cli -o ./amd64/porter ./cli &
  202. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -o ./amd64/docker-credential-porter ./cmd/docker-credential-porter/ &
  203. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -tags ee -o ./amd64/portersvr ./cmd/app/ &
  204. wait
  205. mkdir -p ./release/darwin
  206. zip --junk-paths ./release/darwin/UNSIGNED_porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip ./amd64/porter
  207. zip --junk-paths ./release/darwin/UNSIGNED_portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip ./amd64/portersvr
  208. zip --junk-paths ./release/darwin/UNSIGNED_docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip ./amd64/docker-credential-porter
  209. env:
  210. GOOS: darwin
  211. GOARCH: amd64
  212. CGO_ENABLED: 0
  213. - name: Upload binaries
  214. uses: actions/upload-artifact@v2
  215. with:
  216. path: ./release/darwin
  217. name: mac-binaries
  218. retention-days: 1
  219. notarize:
  220. name: Notarize Darwin binaries
  221. runs-on: macos-11
  222. needs: build-mac
  223. steps:
  224. - name: Get tag name
  225. id: tag_name
  226. run: |
  227. tag=${GITHUB_TAG/refs\/tags\//}
  228. echo ::set-output name=tag::$tag
  229. env:
  230. GITHUB_TAG: ${{ github.ref }}
  231. - name: Download binaries
  232. uses: actions/download-artifact@v2
  233. with:
  234. name: mac-binaries
  235. path: release/
  236. - name: Unzip Darwin binaries
  237. run: |
  238. unzip ./release/UNSIGNED_porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  239. unzip ./release/UNSIGNED_portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  240. unzip ./release/UNSIGNED_docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  241. - name: Import Code-Signing Certificates
  242. uses: Apple-Actions/import-codesign-certs@v1
  243. with:
  244. # The certificates in a PKCS12 file encoded as a base64 string
  245. p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
  246. # The password used to import the PKCS12 file.
  247. p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
  248. - name: Install gon via HomeBrew for code signing and app notarization
  249. run: |
  250. brew tap porter-dev/gon
  251. brew install porter-dev/gon/gon
  252. - name: Create a porter.gon.json file
  253. run: |
  254. echo "
  255. {
  256. \"source\": [\"./porter\"],
  257. \"bundle_id\": \"cli.porter\",
  258. \"apple_id\": {
  259. \"password\": \"@env:AC_PASSWORD\"
  260. },
  261. \"sign\": {
  262. \"application_identity\": \"${{ secrets.AC_APPLICATION_IDENTITY }}\"
  263. },
  264. \"zip\": {
  265. \"output_path\": \"./release/porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip\"
  266. }
  267. }
  268. " > ./porter.gon.json
  269. - name: Create a portersvr.gon.json file
  270. run: |
  271. echo "
  272. {
  273. \"source\": [\"./portersvr\"],
  274. \"bundle_id\": \"cli.portersvr\",
  275. \"apple_id\": {
  276. \"password\": \"@env:AC_PASSWORD\"
  277. },
  278. \"sign\": {
  279. \"application_identity\": \"${{ secrets.AC_APPLICATION_IDENTITY }}\"
  280. },
  281. \"zip\": {
  282. \"output_path\": \"./release/portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip\"
  283. }
  284. }
  285. " > ./portersvr.gon.json
  286. - name: Create a docker-credential-porter.gon.json file
  287. run: |
  288. echo "
  289. {
  290. \"source\": [\"./docker-credential-porter\"],
  291. \"bundle_id\": \"cli.docker-credential-porter\",
  292. \"apple_id\": {
  293. \"password\": \"@env:AC_PASSWORD\"
  294. },
  295. \"sign\": {
  296. \"application_identity\": \"${{ secrets.AC_APPLICATION_IDENTITY }}\"
  297. },
  298. \"zip\": {
  299. \"output_path\": \"./release/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip\"
  300. }
  301. }
  302. " > ./docker-credential-porter.gon.json
  303. - name: Sign the mac binaries with Gon
  304. env:
  305. AC_USERNAME: ${{ secrets.AC_USERNAME }}
  306. AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
  307. run: |
  308. gon ./porter.gon.json &
  309. gon ./portersvr.gon.json &
  310. gon ./docker-credential-porter.gon.json &
  311. wait
  312. - name: Upload binaries
  313. uses: actions/upload-artifact@v2
  314. with:
  315. path: ./release
  316. name: mac-binaries
  317. retention-days: 1
  318. release:
  319. name: Zip binaries, create release and upload assets
  320. runs-on: ubuntu-latest
  321. needs:
  322. - notarize
  323. - build-linux
  324. steps:
  325. - name: Get tag name
  326. id: tag_name
  327. run: |
  328. tag=${GITHUB_TAG/refs\/tags\//}
  329. echo ::set-output name=tag::$tag
  330. env:
  331. GITHUB_TAG: ${{ github.ref }}
  332. - name: Download binaries
  333. uses: actions/download-artifact@v2
  334. with:
  335. name: linux-binaries
  336. path: release/linux
  337. - name: Download binaries
  338. uses: actions/download-artifact@v2
  339. with:
  340. name: static-binaries
  341. path: release/static
  342. - name: Download binaries
  343. uses: actions/download-artifact@v2
  344. with:
  345. name: mac-binaries
  346. path: release/darwin
  347. - name: Create Release
  348. id: create_release
  349. uses: actions/create-release@v1
  350. env:
  351. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  352. with:
  353. tag_name: ${{ github.ref }}
  354. release_name: Release ${{ github.ref }}
  355. draft: false
  356. prerelease: true
  357. - name: Upload Linux CLI Release Asset
  358. id: upload-linux-cli-release-asset
  359. uses: actions/upload-release-asset@v1
  360. env:
  361. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  362. GITHUB_TAG: ${{ github.ref }}
  363. with:
  364. upload_url: ${{ steps.create_release.outputs.upload_url }}
  365. asset_path: ./release/linux/porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  366. asset_name: porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  367. asset_content_type: application/zip
  368. - name: Upload Linux Server Release Asset
  369. id: upload-linux-server-release-asset
  370. uses: actions/upload-release-asset@v1
  371. env:
  372. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  373. GITHUB_TAG: ${{ github.ref }}
  374. with:
  375. upload_url: ${{ steps.create_release.outputs.upload_url }}
  376. asset_path: ./release/linux/portersvr_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  377. asset_name: portersvr_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  378. asset_content_type: application/zip
  379. - name: Upload Linux Docker Credential Release Asset
  380. id: upload-linux-docker-cred-release-asset
  381. uses: actions/upload-release-asset@v1
  382. env:
  383. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  384. GITHUB_TAG: ${{ github.ref }}
  385. with:
  386. upload_url: ${{ steps.create_release.outputs.upload_url }}
  387. asset_path: ./release/linux/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  388. asset_name: docker-credential-porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  389. asset_content_type: application/zip
  390. - name: Upload Darwin CLI Release Asset
  391. id: upload-darwin-cli-release-asset
  392. uses: actions/upload-release-asset@v1
  393. env:
  394. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  395. GITHUB_TAG: ${{ github.ref }}
  396. with:
  397. upload_url: ${{ steps.create_release.outputs.upload_url }}
  398. asset_path: ./release/darwin/porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  399. asset_name: porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  400. asset_content_type: application/zip
  401. - name: Upload Darwin Server Release Asset
  402. id: upload-darwin-server-release-asset
  403. uses: actions/upload-release-asset@v1
  404. env:
  405. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  406. GITHUB_TAG: ${{ github.ref }}
  407. with:
  408. upload_url: ${{ steps.create_release.outputs.upload_url }}
  409. asset_path: ./release/darwin/portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  410. asset_name: portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  411. asset_content_type: application/zip
  412. - name: Upload Darwin Docker Credential Release Asset
  413. id: upload-darwin-docker-cred-release-asset
  414. uses: actions/upload-release-asset@v1
  415. env:
  416. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  417. GITHUB_TAG: ${{ github.ref }}
  418. with:
  419. upload_url: ${{ steps.create_release.outputs.upload_url }}
  420. asset_path: ./release/darwin/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  421. asset_name: docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  422. asset_content_type: application/zip
  423. - name: Upload Static Release Asset
  424. id: upload-static-release-asset
  425. uses: actions/upload-release-asset@v1
  426. env:
  427. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  428. GITHUB_TAG: ${{ github.ref }}
  429. with:
  430. upload_url: ${{ steps.create_release.outputs.upload_url }}
  431. asset_path: ./release/static/static_${{steps.tag_name.outputs.tag}}.zip
  432. asset_name: static_${{steps.tag_name.outputs.tag}}.zip
  433. asset_content_type: application/zip
  434. build-push-docker-cli:
  435. name: Build a new porter-cli docker image
  436. runs-on: ubuntu-latest
  437. needs: release
  438. steps:
  439. - name: Get tag name
  440. id: tag_name
  441. run: |
  442. tag=${GITHUB_TAG/refs\/tags\//}
  443. echo ::set-output name=tag::$tag
  444. env:
  445. GITHUB_TAG: ${{ github.ref }}
  446. - name: Checkout
  447. uses: actions/checkout@v2.3.4
  448. - name: Configure AWS credentials
  449. uses: aws-actions/configure-aws-credentials@v1
  450. with:
  451. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  452. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  453. aws-region: us-east-2
  454. - name: Login to ECR public
  455. id: login-ecr
  456. run: |
  457. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  458. - name: Build
  459. run: |
  460. docker build ./services/porter_cli_container \
  461. -t public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}} \
  462. -f ./services/porter_cli_container/Dockerfile \
  463. --build-arg VERSION=${{steps.tag_name.outputs.tag}} \
  464. --build-arg SENTRY_DSN=${{secrets.SENTRY_DSN}}
  465. - name: Push
  466. run: |
  467. docker push public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
  468. update-porter-update-action:
  469. name: Update porter-update-action
  470. runs-on: ubuntu-latest
  471. needs: build-push-docker-cli
  472. steps:
  473. - name: Get tag name
  474. id: tag_name
  475. run: |
  476. tag=${GITHUB_TAG/refs\/tags\//}
  477. echo ::set-output name=tag::$tag
  478. env:
  479. GITHUB_TAG: ${{ github.ref }}
  480. - name: Push new branch with updated CLI
  481. run: |
  482. cd $GITHUB_WORKSPACE
  483. git clone https://portersupport:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/porter-update-action
  484. cd porter-update-action
  485. git checkout -B "${{steps.tag_name.outputs.tag}}"
  486. cat >Dockerfile <<EOL
  487. FROM public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
  488. COPY entrypoint.sh /action/
  489. ENTRYPOINT ["/action/entrypoint.sh"]
  490. EOL
  491. git config user.name "Update Bot"
  492. git config user.email "support@porter.run"
  493. git add .
  494. git commit -m "Update to CLI version ${{steps.tag_name.outputs.tag}}"
  495. git push --set-upstream origin ${{steps.tag_name.outputs.tag}} -f
  496. update-porter-cli-action:
  497. name: Update porter-cli-action
  498. runs-on: ubuntu-latest
  499. needs: build-push-docker-cli
  500. steps:
  501. - name: Get tag name
  502. id: tag_name
  503. run: |
  504. tag=${GITHUB_TAG/refs\/tags\//}
  505. echo ::set-output name=tag::$tag
  506. env:
  507. GITHUB_TAG: ${{ github.ref }}
  508. - name: Push new branch with updated CLI
  509. run: |
  510. cd $GITHUB_WORKSPACE
  511. git clone https://portersupport:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/porter-cli-action
  512. cd porter-cli-action
  513. git checkout -B "${{steps.tag_name.outputs.tag}}"
  514. cat >Dockerfile <<EOL
  515. FROM public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
  516. COPY entrypoint.sh /action/
  517. ENTRYPOINT ["/action/entrypoint.sh"]
  518. EOL
  519. git config user.name "Update Bot"
  520. git config user.email "support@porter.run"
  521. git add .
  522. git commit -m "Update to CLI version ${{steps.tag_name.outputs.tag}}"
  523. git push --set-upstream origin ${{steps.tag_name.outputs.tag}} -f
  524. update-new-release-tests:
  525. name: Update new-release-tests
  526. runs-on: ubuntu-latest
  527. needs: [update-porter-update-action, update-porter-cli-action]
  528. steps:
  529. - name: Get tag name
  530. id: tag_name
  531. run: |
  532. tag=${GITHUB_TAG/refs\/tags\//}
  533. echo ::set-output name=tag::$tag
  534. env:
  535. GITHUB_TAG: ${{ github.ref }}
  536. - name: Update new-release-tests
  537. run: |
  538. cd $GITHUB_WORKSPACE
  539. git clone https://portersupport:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/new-release-tests
  540. cd new-release-tests/.github/workflows
  541. sed -i 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_pack_production.yml
  542. sed -i 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_pack_production.yml
  543. sed -i 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_docker_production.yml
  544. sed -i 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_docker_production.yml
  545. sed -i 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' test_porter_cli.yml
  546. sed -i 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' test_porter_cli.yml
  547. cd ../..
  548. git config user.name "Update Bot"
  549. git config user.email "support@porter.run"
  550. git diff --quiet --exit-code || git add . && git commit -m "Update to Porter GHA version ${{steps.tag_name.outputs.tag}}" && git push -f
  551. git checkout test-preview-env
  552. git merge main -m "Merge with main"
  553. sed -i 's/TEST:v.*/TEST:${{ steps.tag_name.outputs.tag }}/g' porter.yaml
  554. git diff --quiet --exit-code || git add . && git commit -m "Update to Porter GHA version ${{steps.tag_name.outputs.tag}}" && git push -f
  555. run-new-release-tests-workflows:
  556. name: Run new-release-tests Porter workflows
  557. runs-on: ubuntu-latest
  558. needs: update-new-release-tests
  559. steps:
  560. - name: Run porter_test_pack_production.yml workflow
  561. run: gh workflow run porter_test_pack_production.yml --repo porter-dev/new-release-tests
  562. env:
  563. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}
  564. - name: Run porter_test_docker_production.yml workflow
  565. run: gh workflow run porter_test_docker_production.yml --repo porter-dev/new-release-tests
  566. env:
  567. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}
  568. - name: Run test_porter_cli.yml workflow
  569. run: gh workflow run test_porter_cli.yml --repo porter-dev/new-release-tests
  570. env:
  571. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}