# 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@v7 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@v4 with: submodules: true - name: Create .gitversion run: | echo "${{ needs.variables.outputs.short_sha }}" > .gitversion - 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=.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-${{ 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 defaults: run: shell: powershell steps: - uses: actions/checkout@v4 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.py EDMarketConnector/*.manifest EDMarketConnector/coriolis-data/ EDMarketConnector/img/ EDMarketConnector/pyproject.toml EDMarketConnector/scripts/ EDMarketConnector/tests/' - uses: actions/setup-python@v5 with: python-version-file: '.python-version' architecture: "x86" - name: Install python tools run: | pip install wheel pip install -r requirements-dev.txt - name: Download winsparkle run: | Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.8.1/WinSparkle-0.8.1.zip -OutFile out.zip Expand-Archive out.zip Move-Item 'out\WinSparkle-0.8.1\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 {"EDMarketConnector_Installer_Unsigned_$($_.Name -replace '^EDMarketConnector_Installer_', '')"} - name: Upload build files uses: actions/upload-artifact@v3 with: name: Built files path: | EDMarketConnector_Installer_*.exe EDMarketConnector-release-*.zip release: name: Release new version runs-on: ubuntu-latest needs: [ windows_build, linux_build ] if: "${{ github.event_name != 'workflow_dispatch' }}" steps: - name: Download binary uses: actions/download-artifact@v3 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@v2" 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