chore: update ci #11
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: build-torrserver | |
#on: | |
# release: | |
# types: [published] | |
on: [push, pull_request] | |
jobs: | |
checkTSVersion: | |
runs-on: ubuntu-latest | |
outputs: | |
run_build_assets: ${{ steps.set_output.outputs.build_assets }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
- name: Get latest TorrServer version | |
run: | | |
TS_VERSION_LATEST="$(curl -sL https://api.github.com/repos/YouROK/TorrServer/releases/latest | jq -r '.tag_name')" | |
echo "TS_VERSION_LATEST=${TS_VERSION_LATEST}" >> ${GITHUB_ENV} | |
- name: Check assets version | |
id: set_output | |
working-directory: ./torrserver/assets | |
run: | | |
TS_VERSION_ASSETS=$(cat VERSION) | |
echo "TS version latest: ${TS_VERSION_LATEST}" | |
echo "TS version assets: ${TS_VERSION_ASSETS}" | |
if [[ "$TS_VERSION_LATEST" != "$TS_VERSION_ASSETS" ]]; then | |
echo "Latest version is not equal version in assets" | |
echo "::set-output name=build_assets::true" | |
else | |
echo "Latest version is the same as in assets" | |
echo "::set-output name=build_assets::false" | |
fi | |
buildAssets: | |
needs: [ checkTSVersion ] | |
if: needs.checkTSVersion.outputs.run_build_assets == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: tag number | |
run : echo ${{ github.event.release.tag_name }} | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set Node.js 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.21.2' | |
# - name: Set up QEMU | |
# uses: docker/[email protected] | |
# - name: Set up Docker Buildx | |
# uses: docker/[email protected] | |
# - name: Login to GitHub Container Registry | |
# uses: docker/[email protected] | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
- name: set lower case owner name | |
run: | | |
echo "REG_REPO=${REPO,,}" >>${GITHUB_ENV} | |
env: | |
REPO: '${{ github.repository }}' | |
- name: Set env | |
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV | |
- name: Get latest TorrServer version | |
run: | | |
export TS_VERSION="$(curl -sL https://api.github.com/repos/YouROK/TorrServer/releases/latest | jq -r '.tag_name')" | |
echo "TS_VERSION=${TS_VERSION}" >> ${GITHUB_ENV} | |
- name: CHECK ENVS | |
run: | | |
echo TS_VERSION=${{ env.TS_VERSION }} | |
- name: Prepare TorrServer source | |
working-directory: ./torrserver/.build | |
run: | | |
git clone --depth 1 --branch $TS_VERSION https://github.com/YouROK/TorrServer.git | |
cp ./build-all.sh ./TorrServer/build-all.sh | |
- name: Run build | |
working-directory: ./torrserver/.build/TorrServer | |
run: | | |
./build-all.sh | |
- name: Copy assets | |
working-directory: ./torrserver | |
run: | | |
rm -rf ./assets | |
cp -r ./.build/TorrServer/dist ./assets | |
- name: Commit assets | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: ./torrserver/assets | |
message: 'chore: added assets' | |
# - name: Build and push | |
# uses: docker/[email protected] | |
# with: | |
# context: . | |
# platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
# push: true | |
# tags: | | |
# ghcr.io/${{ env.REG_REPO }}:${{ github.event.release.tag_name }} | |
# ghcr.io/${{ env.REG_REPO }}:latest |