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

Draft: Test use new build action #3

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
101 changes: 54 additions & 47 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,86 @@ on:
- completed
push:
branches: [ master ]

pull_request:
branches: [ master, dev ]
types:
- synchronize

jobs:
build:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7]
os: [macOS-latest, windows-latest]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.7'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x86'
# You can test your matrix by printing the current Python version

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
py -3.7-32 -m pip install --upgrade pip
py -3.7-32 -m pip install -r requirements/app.txt
py -3.7-32 -m pip install -r requirements/app.txt --target ./src/


- name: Build plugin
uses: GOG-Nebula/action-build-plugin@feat/simple_composite_action
with:
target: ./build

# TODO - thinks about the flow for release
#
# Option 1 (simple) - release job have to be after build job
# 1 build job with upload artifacts
# 2 release job:
# - download all artifacts
# - create and publish Github release
#
# Option 2a (saves resources):
# 1. create release job
# 2. build job
# - build action (can expose build.zip inside build action)
# - upload directly to previously created release
# 3. publish release job
# Option 2b -- release job wraps build job so plugin have only build for MR and release for `master` set ups
#
# Option 3:
# - release previously build&tested artifacts (don't build them again)
Comment on lines +34 to +51
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@urwrstkn8mare planning futher steps here. Please take a look 👀

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@UncleGoogle I think we should use Option 3. So that all commits to other branches will have build artifacts so other people can download it and test it. But when changes are merged to master (with mandatory version bump) we can release the previously built artifact. Is that something that sounds good to you? Option 2b might also be able to be used instead for the same flow I think?

#
# release:
# - uses GOG-Nebula/action-release-plugin
# with:
# target-build: ./build
# zip_name:

- name: Create zip archive
shell: bash
env:
ZIP_NAME: uplay_win_afb5a69c-b2ee-4d58-b916-f4cd75d4999a
ZIP_NAME: uplay_${{ runner.os }}_afb5a69c-b2ee-4d58-b916-f4cd75d4999a
run: |
7z a ${ZIP_NAME}.zip ./src/*
7z a ${ZIP_NAME}.zip ./build/*

- name: get version
id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'src/manifest.json'
path: 'build/manifest.json'
prop_path: 'version'

- name: Upload result
uses: actions/upload-artifact@v1
with:
name: uplay_win_${{steps.version.outputs.prop}}
path: uplay_win_afb5a69c-b2ee-4d58-b916-f4cd75d4999a.zip
- name: Automatic Releases
uses: marvinpinto/action-automatic-releases@latest
with:
# GitHub secret token
repo_token: ${{ secrets.GITHUB_TOKEN }}
# Git tag (for automatic releases)
automatic_release_tag: early_release_${{steps.version.outputs.prop}}
# Should this release be marked as a pre-release?
prerelease: True
# Release title (for automatic releases)
title: early_release_${{steps.version.outputs.prop}}
# Assets to upload to the release
files: uplay_win_afb5a69c-b2ee-4d58-b916-f4cd75d4999a.zip
name: uplay_${{ runner.os }}_${{steps.version.outputs.prop}}
path: uplay_${{ runner.os }}_afb5a69c-b2ee-4d58-b916-f4cd75d4999a.zip

# - name: Automatic Releases
# uses: marvinpinto/action-automatic-releases@latest
# with:
# # GitHub secret token
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# # Git tag (for automatic releases)
# automatic_release_tag: early_release_${{steps.version.outputs.prop}}
# # Should this release be marked as a pre-release?
# prerelease: True
# # Release title (for automatic releases)
# title: early_release_${{steps.version.outputs.prop}}
# # Assets to upload to the release
# files: uplay_win_afb5a69c-b2ee-4d58-b916-f4cd75d4999a.zip