Update 30_bluetooth.sh #514
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: builder | |
on: | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- '*' | |
release: | |
types: [created] | |
jobs: | |
builder: | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-24.04-arm | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: build | |
run: | | |
sudo apt-get update | |
sudo apt install qemu-user-static s3fs | |
sudo pip install requests | |
mkdir images && sudo APIKEY=${{ secrets.GITHUBAPITOKEN }} USERNAME=${{ secrets.GITHUBUSERNAME }} PATH=./node_modules/.bin:$PATH ./builder --noninteractive | |
image=$(find images/*.img | head -1) | |
[[ -n "$image" ]] || exit 1 | |
release=$(git tag --points-at HEAD | tail -n2 2>/dev/null | sed -e 's/^release-//') | |
[[ -z "$release" ]] && echo "Build Successful; no release" >&2 && exit 0 | |
echo "RELEASE=$release" >> $GITHUB_ENV | |
echo "IMAGE=$image" >> $GITHUB_ENV | |
- name: deploy | |
if: ${{ env.RELEASE }} | |
run: | | |
sudo npm install -g @treehouses/cli | |
#export gitter_channel="${{ secrets.CHANNEL }}" | |
image=${{ env.IMAGE }} | |
release=${{ env.RELEASE }} | |
release_is_number() { echo "$release" | grep -Eqx "[0-9]+" ; } | |
name="treehouse-$release-arm64" | |
image_gz="$name.img.gz" | |
image_sha1=$image_gz.sha1 | |
image_dir="experiment/" | |
if release_is_number; then | |
image_dir="" | |
fi | |
echo "compressing ..." | |
gzip -c -9 < "$image" > "$image_gz" | |
sync | |
echo "hashing ..." | |
sha1sum "$image_gz" > "$image_sha1" | |
sync | |
echo "${{ secrets.AWSACCESSKEYID }}:${{ secrets.AWSACCESSKEYSECRET }}" > .passwd-s3fs | |
chmod 600 .passwd-s3fs | |
sudo rm -rf /var/www/html | |
sudo mkdir -p /var/www/html | |
sudo chmod 666 /var/www/html | |
echo "uploading ..." | |
sudo s3fs treehouses /var/www/html -o passwd_file=./.passwd-s3fs -o allow_other | |
sudo cp "$image_gz" "$image_sha1" "/var/www/html/$image_dir" | |
echo "treehouses image http://download.treehouses.io/$image_dir$image_gz" | |
# - name: apache index | |
# if: ${{ env.RELEASE }} | |
# run: | | |
# sudo mv /var/www/html/index.html index.html.old | |
# sudo sync | |
# sudo systemctl start apache2 | |
# sudo curl http://localhost -o index.html | |
# sudo mv index.html.old /var/www/html/. | |
# sudo sync | |
# sudo mv ./index.html /var/www/html | |
# sudo rm /var/www/html/index.html.old | |
# - name: new index.html | |
# if: ${{ env.RELEASE }} | |
# uses: chetan/invalidate-cloudfront-action@master | |
# env: | |
# DISTRIBUTION: ${{ secrets.AWSDISTRIBUTIONID }} | |
# PATHS: '/index.html' | |
# AWS_REGION: 'us-east-1' | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWSACCESSKEYID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWSACCESSKEYSECRET }} |