2
0

prerelease.yaml 25 KB

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