# vim: tabstop=2 shiftwidth=2 name: Build EDMC on: push: tags: - "Release/*" workflow_dispatch: jobs: variables: outputs: sem_ver: ${{ steps.var.outputs.sem_ver }} short_sha: ${{ steps.var.outputs.short_sha }} runs-on: "ubuntu-latest" steps: - name: Setting global variables uses: actions/github-script@v9 id: var with: script: | core.setOutput('sem_ver', '${{ github.ref_name }}'.replaceAll('Release\/', '')) core.setOutput('short_sha', '${{ github.sha }}'.substring(0, 8)) linux_build: needs: [variables] name: Linux environment build steps runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v6 with: submodules: true - name: Create .gitversion run: | echo "${{ needs.variables.outputs.short_sha }}" > .gitversion - name: Sanitize version for filenames run: echo "SAFE_SEMVER=${{ needs.variables.outputs.sem_ver }}" | tr '/ ' '_' >> $GITHUB_ENV - 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-${SAFE_SEMVER}.tar.gz" \ -C .. \ --exclude=EDMarketConnector-release-*.* \ --exclude=.editorconfig \ --exclude=.flake8 \ --exclude=.gitattributes \ --exclude=.gitignore \ --exclude=.gitmodules \ --exclude=.git \ --exclude=.github \ --exclude=.mypy.ini \ --exclude=.pre-commit-config.yaml \ --exclude=build.py \ --exclude=*.manifest \ --exclude=coriolis-data \ --exclude=img \ --exclude=pyproject.toml \ --exclude=scripts \ --exclude=tests \ EDMarketConnector mv "../EDMarketConnector-release-${SAFE_SEMVER}.tar.gz" . - name: Upload build files uses: actions/upload-artifact@v7 with: name: built-files-linux path: | EDMarketConnector-release-*.tar.gz windows_build_86: needs: [variables] name: Build EDMC (x86) runs-on: windows-latest defaults: run: shell: powershell steps: - uses: actions/checkout@v6 with: submodules: true - name: Sanitize version for filenames run: | $safe = "${{ needs.variables.outputs.sem_ver }}" -replace '[\/ ]', '_' echo "SAFE_SEMVER=$safe" >> $env:GITHUB_ENV - 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: ${{ format('EDMarketConnector/EDMarketConnector-release-{0}.zip', env.SAFE_SEMVER) }} # 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.py EDMarketConnector/*.manifest EDMarketConnector/coriolis-data/ EDMarketConnector/img/ EDMarketConnector/pyproject.toml EDMarketConnector/scripts/ EDMarketConnector/tests/' - uses: actions/setup-python@v6 with: python-version-file: '.python-version' architecture: "x86" cache: 'pip' # caching pip dependencies - name: Install python tools run: | pip install -r requirements-dev.txt - name: Download winsparkle run: | Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.9.3/WinSparkle-0.9.3.zip -OutFile out.zip Expand-Archive out.zip Move-Item 'out\WinSparkle-0.9.3\Release\*' '.\' - name: Build EDMC run: | python build.py - name: InnoSetup uses: sharktide/iscc-cli@1.0.0 with: filepath: './EDMC_Installer_Config.iss' - name: Rename Installer run: | Get-ChildItem -Path . -Filter "EDMarketConnector_Installer_*.exe" | Rename-Item -NewName { $rest = $_.BaseName -replace '^EDMarketConnector_Installer_', '' "EDMarketConnector_Installer_Unsigned_${rest}_x86.exe" } - name: Upload build files uses: actions/upload-artifact@v7 with: name: built-files-windows-x86 path: | EDMarketConnector_Installer_*.exe EDMarketConnector-release-*.zip windows_build_64: needs: [variables] name: Build EDMC (x64) runs-on: windows-latest defaults: run: shell: powershell steps: - uses: actions/checkout@v6 with: submodules: true - name: Sanitize version for filenames run: | $safe = "${{ needs.variables.outputs.sem_ver }}" -replace '[\/ ]', '_' echo "SAFE_SEMVER=$safe" >> $env:GITHUB_ENV - 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: ${{ format('EDMarketConnector/EDMarketConnector-release-{0}.zip', env.SAFE_SEMVER) }} # 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.py EDMarketConnector/*.manifest EDMarketConnector/coriolis-data/ EDMarketConnector/img/ EDMarketConnector/pyproject.toml EDMarketConnector/scripts/ EDMarketConnector/tests/' - uses: actions/setup-python@v6 with: python-version-file: '.python-version' architecture: "x64" cache: 'pip' # caching pip dependencies - name: Install python tools run: | pip install -r requirements-dev.txt - name: Download winsparkle run: | Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.9.3/WinSparkle-0.9.3.zip -OutFile out.zip Expand-Archive out.zip Move-Item 'out\WinSparkle-0.9.3\x64\Release\*' '.\' - name: Build EDMC run: | python build.py - name: InnoSetup uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5 with: filepath: './EDMC_Installer_Config.iss' - name: Rename Installer run: | Get-ChildItem -Path . -Filter "EDMarketConnector_Installer_*.exe" | Rename-Item -NewName { $rest = $_.BaseName -replace '^EDMarketConnector_Installer_', '' "EDMarketConnector_Installer_Unsigned_${rest}_x64.exe" } - name: Upload build files uses: actions/upload-artifact@v7 with: name: built-files-windows-64 path: | EDMarketConnector_Installer_*.exe EDMarketConnector-release-*.zip Merge: runs-on: ubuntu-latest needs: [ windows_build_64, windows_build_86, linux_build ] steps: - name: Merge Artifacts uses: actions/upload-artifact/merge@v7 with: name: Built files pattern: built-files-* release: name: Release new version runs-on: ubuntu-latest needs: Merge if: "${{ github.event_name != 'workflow_dispatch' }}" steps: - name: Download binary uses: actions/download-artifact@v8 with: name: Built files path: ./ - name: Hash files run: sha256sum EDMarketConnector_Installer_*.exe EDMarketConnector-release-*.{zip,tar.gz} > ./hashes.sum - name: Create Draft Release uses: "softprops/action-gh-release@v3" with: token: "${{secrets.GITHUB_TOKEN}}" draft: true prerelease: true discussion_category_name: "Announcement" files: | ./EDMarketConnector_Installer_*.exe ./EDMarketConnector-release-*.zip ./EDMarketConnector-release-*.tar.gz ./hashes.sum