From 7dc94f05315b33759e4ad8cbd7ce66c0ea511bd1 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 11 Jul 2021 15:16:32 +0200 Subject: [PATCH] Prepare for launcher --- .github/workflows/build.yml | 200 +++++------------------- .github/workflows/draft-new-release.yml | 41 +---- .github/workflows/release.yml | 80 ++++++++++ src/client/component/updater.cpp | 2 +- 4 files changed, 124 insertions(+), 199 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f89e1ee..6d6ea08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,211 +6,91 @@ on: - "*" pull_request: branches: - - master - types: [closed, opened, synchronize, reopened] - + - "*" + types: [opened, synchronize, reopened] jobs: - modify: - runs-on: ubuntu-latest - name: Apply Git modifications if any are necessary - steps: - - name: Check out files - uses: actions/checkout@v2 - with: - submodules: false - lfs: false - - # Set up committer info and GPG key - - name: Import GPG key - if: github.event.pull_request.merged - id: import_gpg - uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516 - with: - git-commit-gpgsign: true - git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}" - git-committer-name: "${{ secrets.XLABS_CI_NAME }}" - git-push-gpgsign: false - git-tag-gpgsign: true - git-user-signingkey: true - gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }} - - - name: Extract version from changelog - if: github.event.pull_request.merged - id: changelog_reader - uses: mindsers/changelog-reader-action@v2 - with: - validation_depth: 10 - path: ./CHANGELOG.md - - - name: Create annotated tag - if: github.event.pull_request.merged - run: | - git tag -a -m "${{ steps.changelog_reader.outputs.changes }}" \ - "${{ steps.changelog_reader.outputs.version }}" \ - "${{ github.event.pull_request.merge_commit_sha }}" - git push origin --tags - build: name: Build binaries runs-on: windows-latest - needs: - - modify strategy: matrix: configuration: - Debug - Release steps: + - name: Wait for previous workflows + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: softprops/turnstyle@v1 + with: + poll-interval-seconds: 10 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check out files uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - # NOTE - if LFS ever starts getting used during builds, switch this to true! + # NOTE - If LFS ever starts getting used during builds, switch this to true! lfs: false - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.2 - name: Generate project files - run: tools/premake5 vs2019 + run: tools/premake5 vs2019 --ci-build - name: Set up problem matching uses: ammaraskar/msvc-problem-matcher@master - name: Build ${{matrix.configuration}} binaries - run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/s1x.sln + run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/launcher.sln - name: Upload ${{matrix.configuration}} binaries uses: actions/upload-artifact@v2 with: name: ${{matrix.configuration}} binaries path: | - build/bin/x64/${{matrix.configuration}}/* + build/bin/x64/${{matrix.configuration}}/s1x.exe + build/bin/x64/${{matrix.configuration}}/s1x.pdb - - name: Upload ${{matrix.configuration}} debug symbols - uses: actions/upload-artifact@v2 - with: - name: ${{matrix.configuration}} debug symbols - path: | - build/bin/**/*.pdb - - release: - name: Create new GitHub Release + deploy: + name: Deploy artifacts needs: build runs-on: ubuntu-latest - if: github.event.pull_request.merged + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') steps: - - name: Check out files - uses: actions/checkout@v2 - with: - submodules: false - lfs: false + - name: Setup main environment + if: github.ref == 'refs/heads/master' + run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH }}" >> $GITHUB_ENV + + - name: Setup develop environment + if: github.ref == 'refs/heads/develop' + run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH_DEV }}" >> $GITHUB_ENV - name: Download Release binaries uses: actions/download-artifact@v2 with: name: Release binaries - # Set up committer info and GPG key - - name: Import GPG key - id: import_gpg - uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516 + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 with: - git-commit-gpgsign: true - git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}" - git-committer-name: "${{ secrets.XLABS_CI_NAME }}" - git-push-gpgsign: false - git-tag-gpgsign: true - git-user-signingkey: true - gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }} + key: ${{ secrets.XLABS_MASTER_SSH_PRIVATE_KEY }} + known_hosts: 'just-a-placeholder-so-we-dont-get-errors' - - name: Extract version from changelog - id: changelog_reader - uses: mindsers/changelog-reader-action@v2 + - name: Add known hosts + run: ssh-keyscan -H ${{ secrets.XLABS_MASTER_SSH_ADDRESS }} >> ~/.ssh/known_hosts + + - name: Wait for previous workflows + uses: softprops/turnstyle@v1 with: - validation_depth: 2 - path: ./CHANGELOG.md - - - uses: papeloto/action-zip@v1 - with: - recursive: false - files: s1x.exe - dest: s1x-${{ steps.changelog_reader.outputs.version }}.zip - - name: Sign ZIP file - run: gpg --output "s1x-${{ steps.changelog_reader.outputs.version }}.zip.sig" --detach-sig "s1x-${{ steps.changelog_reader.outputs.version }}.zip" - - - name: Create Release - id: create_release - uses: actions/create-release@v1 + poll-interval-seconds: 10 env: - GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} - with: - tag_name: ${{ steps.changelog_reader.outputs.version }} - release_name: ${{ steps.changelog_reader.outputs.version }} - body: ${{ steps.changelog_reader.outputs.changes }} - draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} - prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload Release ZIP - id: upload-release-zip - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/s1x-${{ steps.changelog_reader.outputs.version }}.zip - asset_name: s1x-${{ steps.changelog_reader.outputs.version }}.zip - asset_content_type: application/zip + - name: Upload s1x binary + run: rsync -avz s1x.exe ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/s1x/ - - name: Upload Release ZIP signature - id: upload-release-zip-signature - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/s1x-${{ steps.changelog_reader.outputs.version }}.zip.sig - asset_name: s1x-${{ steps.changelog_reader.outputs.version }}.zip.sig - asset_content_type: text/plain - - - name: Remove extra files - run: git clean -ffdx && git reset --hard - - - name: Create Pull Request to merge master back into develop - uses: peter-evans/create-pull-request@v3 - env: - GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} - with: - delete-branch: false - author: "${{ secrets.XLABS_CI_NAME }} <${{ secrets.XLABS_CI_EMAIL }}>" - committer: "${{ secrets.XLABS_CI_NAME }} <${{ secrets.XLABS_CI_EMAIL }}>" - branch: release/${{ steps.changelog_reader.outputs.version }} - base: develop - body: | - This Pull Request contains all changes done for the release of ${{ steps.changelog_reader.outputs.version }}, ready to be merged back into `master`. - - This release should be merged in due time to make sure that changes done to files such as the changelog as part of the release are also contained on the `develop` branch. - title: Merge ${{ steps.changelog_reader.outputs.version }} into develop - - notify: - name: Notify Discord - runs-on: ubuntu-latest - if: | - github.repository_owner == 'XLabsProject' && ( - ( - github.event.pull_request.merged - ) || ( - github.event.push.ref == 'refs/heads/master' || - github.event.push.ref == 'refs/heads/develop' - ) - ) - steps: - - name: Post CI status notification to Discord - uses: sarisia/actions-status-discord@v1.7.1 - if: always() - with: - webhook: ${{ secrets.DISCORD_CI_BOT_WEBHOOK }} - title: "Build" + - name: Publish changes + run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }} \ No newline at end of file diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml index 9d2090a..765c60e 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -35,48 +35,13 @@ jobs: gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }} passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }} - - name: Rename Unreleased section in changelog to ${{ steps.normalize_version.outputs.version }} - uses: thomaseizinger/keep-a-changelog-new-release@1.1.0 - with: - version: ${{ steps.normalize_version.outputs.version }} - - - name: Commit changelog - id: make-commit - run: | - git checkout -b "release/${{ steps.normalize_version.outputs.version }}" - git add CHANGELOG.md - git commit -S -m "Prepare release ${{ steps.normalize_version.outputs.version }}" - git push -u origin "release/${{ steps.normalize_version.outputs.version }}" - - echo "::set-output name=commit::$(git rev-parse HEAD)" - - - name: Extract changelog for Pull Request - id: changelog_reader - uses: mindsers/changelog-reader-action@v2 - with: - validation_depth: 10 - version: ${{ steps.normalize_version.outputs.version }} - path: ./CHANGELOG.md - - name: Create Pull Request uses: repo-sync/pull-request@v2 with: github_token: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} - source_branch: "release/${{ steps.normalize_version.outputs.version }}" + source_branch: "develop" destination_branch: "master" pr_body: | - This Pull Request is for the release of S1x ${{ steps.normalize_version.outputs.version }} and was [automatically created by a workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) triggered by @${{ github.actor }}. - - Commit [`${{ steps.make-commit.outputs.commit }}`](https://github.com/${{ github.repository }}/commit/${{ steps.make-commit.outputs.commit }}) includes an update to the changelog to list the new version with its changes. - - # What happens when this PR gets merged? - - After merging this PR, another workflow will create a new tag `${{ steps.normalize_version.outputs.version }}` on the `master` branch and the version will officially be ${{ steps.changelog_reader.outputs.status }} via an actual GitHub release. A final build will be triggered and all binaries and assets will be attached to the GitHub release. - - # Changelog for ${{ steps.normalize_version.outputs.version }} - - These changes will be included in the release: - - ${{ steps.changelog_reader.outputs.changes }} - pr_title: Release ${{ steps.changelog_reader.outputs.version }} + This Pull Request is for the release of X Labs Launcher ${{ steps.normalize_version.outputs.version }} and was [automatically created by a workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) triggered by @${{ github.actor }}. + pr_title: Release ${{ steps.normalize_version.outputs.version }} pr_label: release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..975086b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +name: Release + +on: + pull_request: + branches: + - "master" + types: [closed] +jobs: + merge: + runs-on: ubuntu-latest + name: Merge Release + steps: + - name: Check out files + uses: actions/checkout@v2 + with: + submodules: false + lfs: false + + # Set up committer info and GPG key + - name: Import GPG key + if: github.event.pull_request.merged + id: import_gpg + uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516 + with: + git-commit-gpgsign: true + git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}" + git-committer-name: "${{ secrets.XLABS_CI_NAME }}" + git-push-gpgsign: false + git-tag-gpgsign: true + git-user-signingkey: true + gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }} + + - name: Extract version from pull request + if: github.event.pull_request.merged + id: extract_version + run: | + title="${{ github.event.pull_request.title }}" + version="${title#Release }" + echo "::set-output name=version::$version" + + - name: Create annotated tag + if: github.event.pull_request.merged + run: | + git tag -a -m "${{ github.event.pull_request.title }}" \ + "${{ steps.extract_version.outputs.version }}" \ + "${{ github.event.pull_request.merge_commit_sha }}" + git push origin --tags + + - name: Create Pull Request + uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.XLABS_CI_GITHUB_TOKEN }} + source_branch: "master" + destination_branch: "develop" + pr_body: | + This Pull Request merges the release of X Labs Launcher ${{ steps.extract_version.outputs.version }} and was [automatically created by a workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) triggered by @${{ github.actor }}. + pr_title: Merge release ${{ steps.extract_version.outputs.version }} + pr_label: release + + + notify: + name: Notify Discord + runs-on: ubuntu-latest + if: | + github.repository_owner == 'XLabsProject' && ( + ( + github.event.pull_request.merged + ) || ( + github.event.push.ref == 'refs/heads/master' || + github.event.push.ref == 'refs/heads/develop' + ) + ) + steps: + - name: Post CI status notification to Discord + uses: sarisia/actions-status-discord@v1.7.1 + if: always() + with: + webhook: ${{ secrets.DISCORD_CI_BOT_WEBHOOK }} + title: "Build" diff --git a/src/client/component/updater.cpp b/src/client/component/updater.cpp index a866142..ec1a2db 100644 --- a/src/client/component/updater.cpp +++ b/src/client/component/updater.cpp @@ -98,5 +98,5 @@ namespace updater } #if defined(CI) && !defined(DEBUG) -REGISTER_COMPONENT(updater::component) +//REGISTER_COMPONENT(updater::component) #endif