Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a github workflow to create releases. #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/project_build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Build with Meson and Ninja"
description: "Checks out code, sets up Python, and builds using Meson and Ninja"
inputs:
python-version:
description: "Python version to use"
required: true
default: "3.x"
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ inputs.python-version }}

- name: Install libraries
# run: apk add --no-cache vulkan-loader-dev libdrm-dev libpng-dev ninja-build meson
run: sudo apt-get install libvulkan-dev libdrm-dev libpng-dev ninja-build
shell: bash

- name: Install Meson and Ninja
run: pip install meson
shell: bash

- name: Configure build with Meson on linux
env:
# Customize the meson build type here (release, debug, debugoptimized, etc.)
BUILD_TYPE: release
run: |
meson setup builddir --buildtype=${{env.BUILD_TYPE}}
shell: bash

- name: Compile
run: meson compile -C builddir
shell: bash
27 changes: 0 additions & 27 deletions .github/workflows/meson.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Verify Pull Request

permissions:
contents: read

on:
pull_request:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Build project action
uses: ./.github/actions/project_build
113 changes: 113 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Release Releases for dxvk-tests

permissions:
contents: write

on:
push:
branches:
- master
tags:
- v[0-9]+.*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build_artifacts:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Build project action
uses: ./.github/actions/project_build

- name: Rename linux build artifacts
run: |
mv builddir/vkcube builddir/vkcube-linux
shell: bash

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: build
path: |
builddir/vkcube-linux
if-no-files-found: error

do_release:
runs-on: ubuntu-latest
needs: build_artifacts

steps:
- name: Unpack build artifacts
uses: actions/download-artifact@v2
with:
name: build
path: builddir

- name: Delete existing latest_build Pre-Release
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const release of releases) {
if (release.prerelease && release.name.startsWith('Latest build of branch')) {
await github.rest.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
});
}
}
const { data: tags } = await github.rest.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/latest_build',
});
if (tags.length > 0)
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/latest_build',
});

- name: Check Tag Format
id: check_tag
if: startsWith(github.ref, 'refs/tags/') # Ensure this runs for tags only
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+.*$ ]]; then
echo "tag_matches=true" >> $GITHUB_OUTPUT
else
echo "tag_matches=false" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Create latest build Pre-Release
if: steps.check_tag.outputs.tag_matches != 'true'
uses: ncipollo/release-action@v1
with:
prerelease: true
draft: false
allowUpdates: true
removeArtifacts: true
name: Latest build of branch ${{ github.ref_name }}
commit: ${{ github.ref }}
tag: latest_build
artifacts: |
builddir/*

- name: Create Tagged Release
if: steps.check_tag.outputs.tag_matches == 'true'
uses: ncipollo/release-action@v1
with:
prerelease: false
removeArtifacts: true
name: Release ${{ github.ref_name }}
tag: ${{ github.ref_name }}
artifacts: |
builddir/*