Skip to content

Commit

Permalink
Move Windows workflow to the main release job.
Browse files Browse the repository at this point in the history
  • Loading branch information
sireliah committed Mar 31, 2021
1 parent c6b56ec commit e14c0b4
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 149 deletions.
144 changes: 141 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ on:
tags:
- 'v*'

name: Create Linux x86_64 release
name: Create release

jobs:
build:
name: Create Release
build-linux:
name: Create Linux x86_64 release
runs-on: ubuntu-latest

outputs:
upload_url: ${{ steps.upload.outputs.upload_url }}
tag: ${{ steps.vars.outputs.tag }}

steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -80,3 +82,139 @@ jobs:
- name: Set release outputs
id: upload
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"

gvsbuild:
name: Build GTK libs for Windows
runs-on: windows-latest
needs: build-linux
env:
gvsbuildref: 69cdac34c36d74eeae37006bb0fcedc64ee518dd
gvsbuildupdate: 1

outputs:
cachekey: ${{ steps.output.outputs.cachekey }}

steps:
- name: (GTK binaries) create dir
run: mkdir C:\gtk-build\gtk\x64\release

- name: (GTK binaries) get from cache
uses: actions/cache@v2
id: cache
with:
path: C:\gtk-build\gtk\x64\release\**
key: gvsbuild-${{ env.gvsbuildupdate }}-${{ env.gvsbuildref }}

- name: (GTK binaries) checkout gvsbuild
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: wingtk/gvsbuild
ref: ${{ env.gvsbuildref }}
path: gvsbuild

- name: (GTK binaries) move git binary
if: steps.cache.outputs.cache-hit != 'true'
run: move "C:\Program Files\Git\usr\bin" "C:\Program Files\Git\usr\notbin"
shell: cmd

- name: (GTK binaries) run gvsbuild
if: steps.cache.outputs.cache-hit != 'true'
working-directory: gvsbuild
run: python .\build.py build -p=x64 --vs-ver=16 --msys-dir=C:\msys64 gtk3

- name: (GTK binaries) restore git binary
if: steps.cache.outputs.cache-hit != 'true'
run: move "C:\Program Files\Git\usr\notbin" "C:\Program Files\Git\usr\bin"
shell: cmd

- name: (GTK binaries) output cache key
id: output
run: echo "::set-output name=cachekey::gvsbuild-${{ env.gvsbuildupdate }}-${{ env.gvsbuildref }}"

build-windows:
name: Create Windows x64 release
runs-on: windows-latest
needs: [build-linux, gvsbuild]
steps:
- name: Create GTK binaries dir
run: mkdir C:\gtk-build\gtk\x64\release

- name: Get GTK binaries from cache
uses: actions/cache@v2
id: cache
with:
path: C:\gtk-build\gtk\x64\release\**
key: ${{ needs.gvsbuild.outputs.cachekey }}

- name: Set up env
run: |
echo "PKG_CONFIG=C:\gtk-build\gtk\x64\release\bin\pkgconf.exe" >> $GITHUB_ENV
echo "C:\gtk-build\gtk\x64\release\bin" >> $GITHUB_PATH
shell: bash

- name: Create target path
run: mkdir C:\build

- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true

- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target-dir C:\build

- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-adwaita-icon-theme
mingw-w64-x86_64-hicolor-icon-theme
- name: Copy dependencies
run: |
mkdir $env:PACKAGE_DIR
mkdir $env:PACKAGE_DIR\bin\
mkdir $env:PACKAGE_DIR\lib\
mkdir $env:PACKAGE_DIR\share\
cp C:\build\release\dragit.exe $env:PACKAGE_DIR\bin\
# Those dlls and binaries are provided by gvsbuild
foreach($line in Get-Content .\scripts\windows_deps.txt) {
cp C:\gtk-build\gtk\x64\release\bin\$line $env:PACKAGE_DIR\bin\
}
cp -r C:\gtk-build\gtk\x64\release\share\glib-2.0 $env:PACKAGE_DIR\share\
# Icons are installed from msys2.
# TODO: Figure out the env var for the temp path
cp -r D:\a\_temp\msys\msys64\mingw64\share\icons $env:PACKAGE_DIR\share\
# https://github.com/gtk-rs/gtk/issues/422
cp -r C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0 $env:PACKAGE_DIR\lib\
cp static\README.md $env:PACKAGE_DIR\
env:
PACKAGE_DIR: C:\build\dragit

- name: Build zip package
run: |
cd C:\build\
tar.exe -a -c -f C:\build\dragit_package.zip dragit
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build-linux.outputs.upload_url }}
asset_path: C:\build\dragit_package.zip
asset_name: dragit_${{ needs.build-linux.outputs.tag }}_windows_x64.zip
asset_content_type: application/zip
146 changes: 0 additions & 146 deletions .github/workflows/windows.yml

This file was deleted.

0 comments on commit e14c0b4

Please sign in to comment.