Upload .tar.xz bottles too

This commit is contained in:
Max Howell 2022-09-26 10:56:15 -04:00
parent 6378d2fa48
commit 5657f04b30
4 changed files with 68 additions and 6 deletions

View file

@ -189,6 +189,61 @@ jobs:
echo ${{ inputs.projects }} | xargs -tn1
scripts/test.ts
xz-bottles:
needs: [verify-relocatable, build]
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- macos-11
- ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: pantry
- name: co cli
uses: actions/checkout@v3
with:
path: cli
repository: teaxyz/cli
token: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
- name: HACKS
run: |
mkdir -p ~/opt/tea.xyz/var
ln -s $GITHUB_WORKSPACE/pantry ~/opt/tea.xyz/var/pantry
mkdir ../.git
cp README.md ..
- uses: teaxyz/setup@v0
id: tea
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
- name: download bottles
uses: actions/download-artifact@v3
with:
name: ${{ matrix.platform }}
path: ${{ steps.tea.outputs.prefix }}
- run: scripts/bottle.ts ${{ needs.build.outputs.pkgs }}
id: bottle
env:
COMPRESSION: xz
- name: upload bottles
run: scripts/upload.ts
--pkgs ${{ needs.build.outputs.pkgs }}
--bottles ${{ steps.bottle.outputs.bottles }}
--checksums ${{ steps.bottle.outputs.checksums }}
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 }}
#TODO cloudfront invalidation
notify:
if: always()
needs: [verify-relocatable]

View file

@ -10,7 +10,7 @@ build:
tea.xyz/gx/make: '*'
tea.xyz/gx/cc: c99
script: |
./configure --prefix={{ prefix }}
./configure --prefix="{{ prefix }}"
make --jobs {{ hw.concurrency }}
make install

View file

@ -1,6 +1,10 @@
#!/usr/bin/env -S tea -E
/* ---
dependencies:
gnu.org/tar: ^1.34
tukaani.org/xz: ^5
zlib.net: 1
args:
- deno
- run
@ -27,6 +31,8 @@ const cellar = useCellar()
if (import.meta.main) {
useFlags()
const compression = Deno.env.get("COMPRESSION") == 'xz' ? 'xz' : 'gz'
const bottles: Path[] = []
const checksums: Path[] = []
const artifacts: Path[] = []
@ -34,7 +40,7 @@ if (import.meta.main) {
console.log({ bottling: { pkg } })
const installation = await cellar.resolve(pkg)
const path = await bottle(installation)
const path = await bottle(installation, compression)
const checksum = await sha256(path)
console.log({ bottled: { path } })
@ -60,10 +66,11 @@ if (import.meta.main) {
//------------------------------------------------------------------------- funcs
export async function bottle({ path: kegdir, pkg }: Installation): Promise<Path> {
const tarball = useCache().bottle(pkg)
export async function bottle({ path: kegdir, pkg }: Installation, compression: 'gz' | 'xz'): Promise<Path> {
const tarball = useCache().bottle(pkg, compression)
const z = compression == 'gz' ? 'z' : 'J'
const cwd = usePrefix()
const cmd = ["tar", "zcf", tarball, kegdir.relative({ to: cwd })]
const cmd = ["tar", `c${z}f`, tarball, kegdir.relative({ to: cwd })]
await run({ cmd, cwd })
return tarball
}

View file

@ -12,7 +12,7 @@ args:
- --import-map={{ srcroot }}/import-map.json
---*/
import { Installation, Package, PackageRequirement } from "types"
import { Package, PackageRequirement } from "types"
import { usePantry, useCellar, useFlags } from "hooks"
import useShellEnv, { expand } from "hooks/useShellEnv.ts"
import { run, undent, pkg as pkgutils } from "utils"