Generate code-server archives #57
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: Generate code-server archives | |
on: | |
# push: | |
# branches: | |
# - master | |
# paths: | |
# - .github/workflows/bootstrap_archives.yml | |
# schedule: | |
# - cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: | |
- aarch64 | |
- arm | |
- x86 | |
- x86_64 | |
steps: | |
- name: Git clone | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Free additional disk space | |
run: | | |
sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php|aspnetcore)') \ | |
mono-runtime-common monodoc-manual ruby | |
sudo apt autoremove -yq | |
sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift | |
- name: Build docker | |
run: ./dev.sh build-android-env | |
- name: Create archive | |
run: ./dev.sh docker-run bash -c './dev.sh apply-patch && BUILD_NODE=1 BUILD_RELEASE=1 ANDROID_ARCH=${{ matrix.arch }} ./dev.sh release' | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cs-archives-${{ github.sha }} | |
path: "*.tgz" | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch archives | |
uses: actions/download-artifact@v4 | |
with: | |
name: cs-archives-${{ github.sha }} | |
path: ./ | |
- name: Get checksums | |
id: get_checksums | |
run: | | |
checksums=$(printf 'SHA-256:\n```\n%s\n```\n' "$(sha256sum *.tgz)") | |
# checksums="${checksums//'%'/'%25'}" | |
# checksums="${checksums//$'\n'/'%0A'}" | |
# checksums="${checksums//$'\r'/'%0D'}" | |
echo "checksums<<CSCONTENT" >>$GITHUB_OUTPUT | |
echo "$checksums" >>$GITHUB_OUTPUT | |
echo "CSCONTENT" >>$GITHUB_OUTPUT | |
- name: Create new tag | |
id: get_tag | |
run: | | |
new_tag="cs-$(date "+%Y.%m.%d")" | |
existing_tag_revision=$(git tag | grep "$new_tag" | sort -r | head -n 1 | cut -d- -f3 | cut -dr -f2) | |
if [ -n "$existing_tag_revision" ]; then | |
tag_rev=$((existing_tag_revision + 1)) | |
else | |
tag_rev=1 | |
fi | |
new_tag="${new_tag}-r${tag_rev}" | |
git tag "$new_tag" | |
git push --tags | |
echo "tag_name=$new_tag" >>$GITHUB_OUTPUT | |
- name: Publish GitHub release | |
uses: termux/upload-release-action@v3.0.3 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "*.tgz" | |
file_glob: true | |
release_name: "CS archives for VHEditor application" | |
tag: ${{ steps.get_tag.outputs.tag_name }} | |
body: ${{ steps.get_checksums.outputs.checksums }} |