From 0c31cd222c7146c60af1d1f779e27efcfb3444cf Mon Sep 17 00:00:00 2001 From: uazo <29201891+uazo@users.noreply.github.com> Date: Mon, 17 Jan 2022 17:41:03 +0100 Subject: [PATCH] Create release.yaml --- .github/workflows/release.yaml | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..82f78902 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,97 @@ +name: Release Bromite CI +#permissions: +# contents: write +# repo: write + +on: + workflow_dispatch: + inputs: + sha: + description: 'uazo/bromite SHA' + required: true + default: '0a8ff322d6e9d738f7b2fa52618b178081bd100d' + build: + description: 'arch [arm64/x64]' + required: true + default: 'arm64' + type: + description: 'runner? [dev/ci]' + required: true + default: 'ci' + debug: + description: 'debug? [true/false]' + required: true + default: 'false' + usegoma: + description: 'Use goma? [true/false]' + required: true + default: 'false' + +env: + BROMITE_SHA: ${{ github.event.inputs.sha }} + USEGOMA: ${{ github.event.inputs.usegoma }} + REMOVEDOCKERSUPPORT: true + USELOCALIMAGE: true + GOMAJOBS: 60 + +jobs: + release: + runs-on: ${{ github.event.inputs.type }} + env: + OUTPUTFILE: /storage/images/${{ github.event.inputs.build }}/${{ github.event.inputs.sha }} + APK: ${{ github.event.inputs.build }}_ChromePublic.apk + + steps: + - name: Prepare container + run: | + wget https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip + unzip pup_v0.4.0_linux_amd64.zip && rm pup_v0.4.0_linux_amd64.zip + BRANCH=$(curl https://github.com/uazo/bromite/branch_commits/$BROMITE_SHA | ./pup -p li.branch a text{}) + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + + wget https://github.com/cli/cli/releases/download/v2.4.0/gh_2.4.0_linux_amd64.tar.gz + tar xfz gh_2.4.0_linux_amd64.tar.gz + + - name: Checkout 'uazo/bromite' ${{ env.BRANCH }} + uses: actions/checkout@v2 + with: + repository: 'uazo/bromite' + ref: ${{ github.event.inputs.rtag }} + path: 'bromite' + fetch-depth: 1 + + - name: Copy artifacts + shell: bash + run: | + sudo cp ${{ env.OUTPUTFILE }}/apks/ChromePublic.apk ChromePublic.apk + sudo chown runner ChromePublic.apk + mv ChromePublic.apk $APK + + - name: Create release + shell: bash + run: | + echo ${{ secrets.GITHUB_TOKEN }} | gh_2.4.0_linux_amd64/bin/gh auth login --with-token + + cd bromite + VERSION=v$(cat ${{ env.OUTPUTFILE }}/RELEASE)-${{ github.event.inputs.build }} + ../gh_2.4.0_linux_amd64/bin/gh release create $VERSION \ + ../$APK --notes "" + +# - name: Enable proxy on container +# shell: bash +# run: | +# if ! [[ -z "${HTTP_PROXY}" ]]; then +# PROXY_ADDR=http://$(hostname -I | cut -d' ' -f1 | xargs):8118 +# echo "PROXY_ADDR=$PROXY_ADDR" >> $GITHUB_ENV +# sudo iptables -D INPUT -p tcp -s localhost --dport 8118 -j ACCEPT +# sudo iptables -D INPUT -p tcp --dport 8118 -j DROP +# fi + +# - name: Release build ${{ github.event.inputs.build }}/${{ github.event.inputs.sha }} +# uses: softprops/action-gh-release@v1 +# with: +# draft: true +# body: Apk for ${{ env.APK }} sha ${{ github.event.inputs.sha }} +# files: ${{ env.APK }} +# env: +# HTTP_PROXY: ${{ env.PROXY_ADDR }}