| 1 | name: daily windows |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | inputs: |
| 6 | release_note: |
| 7 | description: 'build and release vendetta for windows' |
| 8 | required: false |
| 9 | default: ':3' |
| 10 | type: string |
| 11 | |
| 12 | jobs: |
| 13 | build-and-release: |
| 14 | runs-on: artix-base |
| 15 | env: |
| 16 | MPV_DLL_VER: 20261021/mpv-dev-x86_64-20261021-git-e471496c56 |
| 17 | |
| 18 | steps: |
| 19 | - name: Install deps |
| 20 | run: | |
| 21 | pacman -Sy --needed --noconfirm mingw-w64-binutils mingw-w64-crt mingw-w64-gcc mingw-w64-headers mingw-w64-winpthreads 7zip base-devel jq mingw-w64-toolchain git nodejs wget |
| 22 | |
| 23 | git clone --depth=1 https://github.com/vlang/v /tmp/v |
| 24 | make -C /tmp/v |
| 25 | /tmp/v/v version |
| 26 | /tmp/v/v install ui2 |
| 27 | |
| 28 | - name: Checkout code |
| 29 | uses: https://data.forgejo.org/actions/checkout@v7 |
| 30 | with: |
| 31 | fetch-depth: 0 |
| 32 | |
| 33 | - name: Build, Package and Release |
| 34 | env: |
| 35 | TOKEN: ${{ forgejo.token }} |
| 36 | API: "https://git.vorelabs.dev/api/v1/repos/vorelabs/vendetta" |
| 37 | NOTE: ${{ inputs.release_note }} |
| 38 | run: | |
| 39 | DATE=$(date +'%d%m%Y') |
| 40 | DATEP=$(date +'%d.%m.%Y') |
| 41 | TAG="$DATE" |
| 42 | |
| 43 | mkdir /tmp/dist |
| 44 | |
| 45 | /tmp/v/v -new-compiler -prod -os windows -d ui2_custom_rendering -o /tmp/dist/vendetta.exe src |
| 46 | cp -R assets/ /tmp/dist/ |
| 47 | |
| 48 | wget https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/$MPV_DLL_VER.7z |
| 49 | 7z e *.7z libmpv-2.dll |
| 50 | mv libmpv-2.dll /tmp/dist |
| 51 | |
| 52 | cd /tmp/dist |
| 53 | sha256sum vendetta.exe libmpv-2.dll > SHA256SUMS |
| 54 | |
| 55 | FILE=/tmp/vendetta-windows-$TAG.zip |
| 56 | 7z a $FILE /tmp/dist/* |
| 57 | |
| 58 | RELEASE_BODY=$(jq -n \ |
| 59 | --arg tag "$TAG" \ |
| 60 | --arg name "Vendetta $DATEP" \ |
| 61 | --arg body "o_O" \ |
| 62 | --arg target "$GITHUB_SHA" \ |
| 63 | '{tag_name: $tag, name: $name, body: $body, target_commitish: $target}') |
| 64 | |
| 65 | RELEASE_JSON=$(curl -fsS -H "Authorization: token $TOKEN" \ |
| 66 | "$API/releases/tags/$TAG" 2>/dev/null || true) |
| 67 | if [ -z "$RELEASE_JSON" ]; then |
| 68 | RELEASE_JSON=$(curl -fsS -X POST "$API/releases" \ |
| 69 | -H "Authorization: token $TOKEN" \ |
| 70 | -H "Content-Type: application/json" \ |
| 71 | -d "$RELEASE_BODY") |
| 72 | fi |
| 73 | |
| 74 | RELEASE_ID=$(printf '%s' "$RELEASE_JSON" | jq -er '.id') |
| 75 | |
| 76 | NAME=$(basename "$FILE") |
| 77 | curl -fsS -X POST "$API/releases/$RELEASE_ID/assets?name=$NAME" \ |
| 78 | -H "Authorization: token $TOKEN" \ |
| 79 | -F "attachment=@$FILE" |
| 80 | |
| 81 | |