2022-12-21 00:54:26 +03:00
|
|
|
name: bottle
|
|
|
|
|
2022-12-21 02:29:41 +03:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
new-version:
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
2023-02-03 01:13:38 +03:00
|
|
|
platform:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-02-07 01:25:37 +03:00
|
|
|
outputs:
|
|
|
|
pr:
|
|
|
|
description: 'The PR number'
|
|
|
|
value: ${{ jobs.bottle.outputs.pr }}
|
2022-12-21 00:54:26 +03:00
|
|
|
|
|
|
|
jobs:
|
2023-02-03 01:13:38 +03:00
|
|
|
get-platform:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2023-02-05 02:49:21 +03:00
|
|
|
os: ${{ steps.platform.outputs.os }}
|
|
|
|
cache-set: ${{ steps.platform.outputs.cache-set }}
|
2023-02-03 01:13:38 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: teaxyz/pantry.core
|
2023-02-11 15:29:19 +03:00
|
|
|
- uses: actions/cache@v3
|
2023-02-05 02:49:21 +03:00
|
|
|
with:
|
|
|
|
path: $HOME/.cache/deno
|
2023-02-05 03:10:30 +03:00
|
|
|
key: ${{ runner.os }}-deno-get-platform-${{ hashFiles('deno.jsonc')}}
|
2023-02-03 01:13:38 +03:00
|
|
|
- uses: teaxyz/setup@v0
|
2023-02-07 21:00:18 +03:00
|
|
|
- run: scripts/get-platform.ts
|
2023-02-03 01:13:38 +03:00
|
|
|
id: platform
|
|
|
|
env:
|
|
|
|
PLATFORM: ${{ inputs.platform }}
|
|
|
|
|
2022-12-21 00:54:26 +03:00
|
|
|
bottle:
|
2023-02-03 01:13:38 +03:00
|
|
|
needs: [get-platform]
|
|
|
|
runs-on: ${{ fromJson(needs.get-platform.outputs.os) }}
|
2022-12-21 00:54:26 +03:00
|
|
|
outputs:
|
|
|
|
srcs: ${{ env.srcs }}
|
|
|
|
built: ${{ env.built }}
|
2023-01-04 02:18:49 +03:00
|
|
|
pr: ${{ env.PR }}
|
2022-12-21 00:54:26 +03:00
|
|
|
steps:
|
|
|
|
- uses: teaxyz/setup@v0
|
|
|
|
id: tea
|
|
|
|
with:
|
2023-02-11 17:59:00 +03:00
|
|
|
srcroot: null
|
2022-12-21 00:54:26 +03:00
|
|
|
prefix: ${{ github.workspace }}
|
2023-02-11 17:59:00 +03:00
|
|
|
|
2023-02-11 15:29:19 +03:00
|
|
|
- uses: actions/cache@v3
|
2023-02-05 03:10:30 +03:00
|
|
|
with:
|
|
|
|
path: ${{ needs.get-platform.outputs.cache-set }}
|
2023-02-11 17:59:00 +03:00
|
|
|
key: ${{ runner.os }}-deno-bottle-${{ hashFiles('tea.xyz/var/pantry/deno.jsonc')}}
|
2022-12-21 00:54:26 +03:00
|
|
|
|
2023-02-03 01:13:38 +03:00
|
|
|
- name: configure scripts PATH
|
2023-02-05 02:49:21 +03:00
|
|
|
run: echo "$TEA_PREFIX/tea.xyz/var/pantry/scripts" >> $GITHUB_PATH
|
2022-12-21 00:54:26 +03:00
|
|
|
|
|
|
|
- uses: actions/download-artifact@v3
|
2022-12-21 02:29:41 +03:00
|
|
|
if: ${{ inputs.new-version }}
|
2022-12-21 00:54:26 +03:00
|
|
|
with:
|
2023-02-03 01:13:38 +03:00
|
|
|
name: ${{ inputs.platform }}
|
2022-12-21 00:54:26 +03:00
|
|
|
|
2023-02-05 02:49:21 +03:00
|
|
|
- run: fetch-pr-artifacts.ts ${{ github.repository }} ${{ github.sha }} ${{ inputs.platform }} >>$GITHUB_ENV
|
2022-12-21 02:29:41 +03:00
|
|
|
if: ${{ !inputs.new-version }}
|
2022-12-21 00:54:26 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{github.token}}
|
|
|
|
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
2023-02-11 17:59:00 +03:00
|
|
|
- run: tar xzvf artifacts.tgz
|
2022-12-21 00:54:26 +03:00
|
|
|
|
|
|
|
- run: |
|
|
|
|
for file in built relative-paths srcs; do
|
|
|
|
echo "$file=$(cat $file)" >>$GITHUB_ENV
|
|
|
|
done
|
|
|
|
|
2023-02-12 10:07:11 +03:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-03 01:13:38 +03:00
|
|
|
if: startsWith(inputs.platform, 'darwin+')
|
2022-12-21 00:54:26 +03:00
|
|
|
with:
|
2023-02-12 10:07:11 +03:00
|
|
|
path: pantry
|
|
|
|
repository: teaxyz/pantry.core
|
|
|
|
- uses: ./pantry/.github/actions/apple-signing
|
2023-02-03 01:13:38 +03:00
|
|
|
if: startsWith(inputs.platform, 'darwin+')
|
2023-02-12 10:07:11 +03:00
|
|
|
with:
|
|
|
|
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_P12 }}
|
|
|
|
p12-password: ${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }}
|
|
|
|
identity: "Developer ID Application: Tea Inc. (7WV56FL599)"
|
|
|
|
paths: ${{ env.relative-paths}}
|
2022-12-21 00:54:26 +03:00
|
|
|
|
|
|
|
- run: |
|
|
|
|
tea +gnupg.org gpg-agent --daemon || true
|
|
|
|
echo $GPG_PRIVATE_KEY | \
|
|
|
|
base64 -d | \
|
|
|
|
tea +gnupg.org gpg --import --batch --yes
|
|
|
|
env:
|
|
|
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
|
|
|
2023-02-05 02:49:21 +03:00
|
|
|
- run: bottle.ts $built
|
2022-12-21 00:54:26 +03:00
|
|
|
id: bottle-xz
|
|
|
|
env:
|
|
|
|
COMPRESSION: xz
|
|
|
|
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
|
|
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
|
|
|
|
2023-02-05 02:49:21 +03:00
|
|
|
- run: bottle.ts $built
|
2022-12-21 00:54:26 +03:00
|
|
|
id: bottle-gz
|
|
|
|
env:
|
|
|
|
COMPRESSION: gz
|
|
|
|
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
|
|
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
|
|
|
|
|
|
|
- run: |
|
|
|
|
echo ${{ steps.bottle-gz.outputs.bottles }} ${{ steps.bottle-xz.outputs.bottles }} >bottles
|
|
|
|
echo ${{ steps.bottle-gz.outputs.checksums }} ${{ steps.bottle-xz.outputs.checksums }} >checksums
|
|
|
|
echo ${{ steps.bottle-gz.outputs.signatures }} ${{ steps.bottle-xz.outputs.signatures }} >signatures
|
|
|
|
|
2023-01-05 04:44:23 +03:00
|
|
|
SRCS=$(echo $srcs | tr -d '~')
|
|
|
|
|
2023-02-11 17:59:00 +03:00
|
|
|
tar cf artifacts.tar \
|
2023-01-05 04:44:23 +03:00
|
|
|
$SRCS \
|
2022-12-21 00:54:26 +03:00
|
|
|
${{ steps.bottle-gz.outputs.bottles }} \
|
|
|
|
${{ steps.bottle-xz.outputs.bottles }} \
|
|
|
|
bottles checksums signatures
|
|
|
|
|
|
|
|
- name: upload artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-02-03 01:13:38 +03:00
|
|
|
name: ${{ inputs.platform }}-bottles
|
2022-12-21 00:54:26 +03:00
|
|
|
path: artifacts.tar
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
upload:
|
|
|
|
needs: [bottle]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: teaxyz/setup@v0
|
|
|
|
id: tea
|
|
|
|
with:
|
2023-02-11 17:59:00 +03:00
|
|
|
srcroot: null
|
|
|
|
prefix: ${{ github.workspace }}
|
|
|
|
|
|
|
|
- name: configure scripts PATH
|
|
|
|
run: echo "${{ steps.tea.outputs.prefix }}/tea.xyz/var/pantry/scripts" >> $GITHUB_PATH
|
2022-12-21 00:54:26 +03:00
|
|
|
|
2023-02-11 15:29:19 +03:00
|
|
|
- uses: actions/cache@v3
|
2023-02-05 03:10:30 +03:00
|
|
|
with:
|
|
|
|
path: $HOME/.cache/deno
|
2023-02-11 17:59:00 +03:00
|
|
|
key: ${{ runner.os }}-deno-bottle-${{ hashFiles('tea.xyz/var/pantry/deno.jsonc')}}
|
2023-02-05 03:10:30 +03:00
|
|
|
|
2022-12-21 00:54:26 +03:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-02-03 01:13:38 +03:00
|
|
|
name: ${{ inputs.platform }}-bottles
|
2022-12-21 00:54:26 +03:00
|
|
|
|
|
|
|
- run: |
|
2023-02-11 17:59:00 +03:00
|
|
|
tar xvf artifacts.tar
|
2022-12-21 00:54:26 +03:00
|
|
|
|
|
|
|
for file in bottles checksums signatures; do
|
|
|
|
echo "$file=$(cat $file)" >>$GITHUB_ENV
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: upload bottles
|
|
|
|
id: upload
|
2023-02-05 02:49:21 +03:00
|
|
|
run: upload.ts
|
2022-12-21 00:54:26 +03:00
|
|
|
--pkgs ${{ needs.bottle.outputs.built }} ${{ needs.bottle.outputs.built }}
|
|
|
|
--srcs ${{ needs.bottle.outputs.srcs }} ${{ needs.bottle.outputs.srcs }}
|
|
|
|
--bottles $bottles
|
|
|
|
--checksums $checksums
|
|
|
|
--signatures $signatures
|
|
|
|
env:
|
|
|
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
|
|
|
- uses: chetan/invalidate-cloudfront-action@v2
|
|
|
|
env:
|
|
|
|
PATHS: ${{ steps.upload.outputs.cf-invalidation-paths }}
|
|
|
|
DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
|
|
|
|
AWS_REGION: us-east-1
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
2023-02-03 01:13:38 +03:00
|
|
|
complain:
|
|
|
|
needs: [upload]
|
2023-02-03 04:07:32 +03:00
|
|
|
if: inputs.new-version == 'true' && failure()
|
|
|
|
uses: ./.github/workflows/complain.yml
|
|
|
|
with:
|
|
|
|
projects: ${{ inputs.projects }}
|
|
|
|
platform: ${{ inputs.platform }}
|
|
|
|
secrets: inherit
|