1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

Merge pull request #1802 from EDCD/enhancement/1801/custom-release-archives

Create a custom .zip archive for releases
This commit is contained in:
Athanasius 2023-01-12 14:05:14 +00:00 committed by GitHub
commit c350782a67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
# vim: tabstop=2 shiftwidth=2
name: Build EDMC for Windows
on:
@ -7,7 +8,61 @@ on:
workflow_dispatch:
jobs:
test:
variables:
outputs:
sem_ver: ${{ steps.var.outputs.sem_ver }}
archive_exclusions: ${{ steps.var.outputs.archive_exclusions }}
runs-on: "ubuntu-latest"
steps:
- name: Setting global variables
uses: actions/github-script@v6
id: var
with:
script: |
core.setOutput('sem_ver', '${{ github.ref_name }}'.replaceAll('Release\/', ''))
linux_build:
needs: [variables]
name: Linux environment build steps
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Make tar archive
run: |
# For 'tar' we can only specify filename/glob exclusions, not any
# directory location
tar -c -v -z \
-f ../EDMarketConnector-release-${{ needs.variables.outputs.sem_ver }}.tar.gz \
-C .. \
--exclude=EDMarketConnector-release-*.* \
--exclude=.editorconfig \
--exclude=.flake8 \
--exclude=.git* \
--exclude=.mypy.ini \
--exclude=.pre-commit-config.yaml \
--exclude=Build-exe-and-msi.py \
--exclude=*.manifest \
--exclude=coriolis-data \
--exclude=img \
--exclude=pyproject.toml \
--exclude=scripts \
--exclude=tests \
--exclude=wix \
EDMarketConnector
mv ../EDMarketConnector-release-${{ needs.variables.outputs.sem_ver }}.tar.gz .
- name: Upload build files
uses: actions/upload-artifact@v3
with:
name: Built files
path: |
EDMarketConnector-release-*.tar.gz
windows_build:
needs: [variables]
name: Build EDMC
runs-on: windows-2019
@ -20,6 +75,25 @@ jobs:
with:
submodules: true
- name: Make zip archive
uses: thedoctor0/zip-release@main
with:
type: 'zip'
# We want an in-zip prefix of `EDMarketConnector/` for all files, so
# we specify that:
# 1. We work from the parent directory
directory: '..'
# 2. The path we're using is the 'root' directory
path: 'EDMarketConnector'
# 3. The .zip file has to be in the 'root' so that upload-artifact
# will process it. Can't use relative paths.
filename: 'EDMarketConnector/EDMarketConnector-release-${{ needs.variables.outputs.sem_ver }}.zip'
# 4. And all the exclusions need to be prefixed with the 'root'
# directory.
# NB: If this gets too long it can cause zip 'Command Line Error',
# presumably due to a Windows CL length limit.
exclusions: 'EDMarketConnector/EDMarketConnector-release-*.* EDMarketConnector/.editorconfig EDMarketConnector/.flake8 EDMarketConnector/.git* EDMarketConnector/.mypy.ini EDMarketConnector/.pre-commit-config.yaml EDMarketConnector/Build-exe-and-msi.py EDMarketConnector/*.manifest EDMarketConnector/coriolis-data/ EDMarketConnector/img/ EDMarketConnector/pyproject.toml EDMarketConnector/scripts/ EDMarketConnector/tests/ EDMarketConnector/wix/'
- uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
@ -44,12 +118,14 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: Built files
path: EDMarketConnector_win*.msi
path: |
EDMarketConnector_win_*.msi
EDMarketConnector-release-*.zip
release:
name: Release new version
runs-on: ubuntu-latest
needs: test
needs: [ windows_build, linux_build ]
if: "${{ github.event_name != 'workflow_dispatch' }}"
steps:
@ -60,7 +136,7 @@ jobs:
path: ./
- name: Hash files
run: sha256sum EDMarketConnector_win*.msi > ./hashes.sum
run: sha256sum EDMarketConnector_win_*.msi EDMarketConnector-release-*.{zip,tar.gz} > ./hashes.sum
- name: Create Draft Release
uses: "softprops/action-gh-release@v1"
@ -70,5 +146,7 @@ jobs:
prerelease: true
discussion_category_name: "Announcement"
files: |
./EDMarketConnector_win*.msi
./EDMarketConnector_win_*.msi
./EDMarketConnector-release-*.zip
./EDMarketConnector-release-*.tar.gz
./hashes.sum