v1.3.1 #37
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cd·www | |
# the binaries for curl pkgx.sh/$(uname)/$(uname -m) | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
inputs: | |
release-id: | |
required: true | |
concurrency: | |
group: cd/www/${{ github.event.release.tag_name || github.event.inputs.release-id }} | |
cancel-in-progress: true | |
jobs: | |
www-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- uses: robinraju/[email protected] | |
with: | |
releaseId: ${{ github.event.release.id || github.event.inputs.release-id }} | |
- name: Unpack Binaries | |
run: | | |
go() { | |
tar xJf $1 | |
mkdir -p out/$2 | |
tar czf out/$2/$3.tgz pkgx | |
cp pkgx out/$2/$3 | |
gzip pkgx | |
mv pkgx.gz out/$2/$3.gz | |
INVALIDATION_PATHS="$INVALIDATION_PATHS /$2/$3 /$2/$3.tgz /$2/$3.gz" | |
} | |
for filename in pkgx-*+*+*.tar.xz; do | |
case $filename in | |
*+darwin+aarch64.tar.xz) | |
go $filename Darwin arm64;; | |
*+darwin+x86-64.tar.xz) | |
go $filename Darwin x86_64;; | |
*+linux+aarch64.tar.xz) | |
go $filename Linux arm64 | |
go $filename Linux aarch64;; | |
*+linux+x86-64.tar.xz) | |
go $filename Linux x86_64 | |
./out/Linux/x86_64 --version | awk '{print $2}' > out/VERSION | |
;; | |
esac | |
done | |
echo "INVALIDATION_PATHS=$INVALIDATION_PATHS" >> $GITHUB_ENV | |
- name: Upload to S3 | |
run: | |
aws s3 sync out/ s3://www.pkgx.sh/ | |
--metadata-directive REPLACE | |
--cache-control "max-age=3600, must-revalidate" | |
- name: Invalidate CloudFront | |
run: | |
aws cloudfront create-invalidation | |
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} | |
--paths $INVALIDATION_PATHS /VERSION |