From 00b6bcb7c71e1f46275bcb44d257ab23ade13e40 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 14 Nov 2021 12:15:40 -0500 Subject: [PATCH 1/5] remove old release workflows --- .github/workflows/release-old.yml | 88 ------------------------------- .github/workflows/release.yml | 88 ------------------------------- 2 files changed, 176 deletions(-) delete mode 100644 .github/workflows/release-old.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release-old.yml b/.github/workflows/release-old.yml deleted file mode 100644 index f07ccef..0000000 --- a/.github/workflows/release-old.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Release new version -on: - workflow_dispatch: - inputs: - version: - description: 'The version number to use' - default: '0.0.0.0' - # Input has to be provided for the workflow to run - required: true -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Validate version number - run: | - # validate version structure - bash -c '[[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 1' - # ensure version doesn't already exist - bash -c 'git rev-parse "v${{ github.event.inputs.version }}" >/dev/null 2>&1 && exit 2 || exit 0' - - name: Checkout - uses: actions/checkout@v2.3.3 - with: - submodules: true - - name: Install dependencies - run: sudo apt install nuget mono-complete make - - name: Update version number, and commit - run: | - git config --global user.name "Github Actions" - git config --global user.email "dyc3@users.noreply.github.com" - sed -ri "s/Version\(\"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\"\)/Version\(\"${{ github.event.inputs.version }}\"\)/g" AssemblyInfo.cs - git commit -m "Update version" AssemblyInfo.cs - - name: Build - run: | - nuget restore SteamAuth/SteamAuth/SteamAuth.sln - make - mv build steamguard-cli-v${{ github.event.inputs.version }} - tar -cf steamguard-cli-v${{ github.event.inputs.version }}.tar.gz steamguard-cli-v${{ github.event.inputs.version }} - - name: Tag and push version commit - run: | - git push origin master - git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Upload Build Artifact - uses: actions/upload-artifact@v2.2.0 - with: - name: build - path: steamguard-cli-v${{ github.event.inputs.version }}.tar.gz - deb-package: - runs-on: ubuntu-latest - needs: [build] - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - name: Download Build Artifact (tar) - uses: actions/download-artifact@v2.0.5 - with: - name: build - - run: | - tar -xf steamguard-cli-v${{ github.event.inputs.version }}.tar.gz - mv steamguard-cli-v${{ github.event.inputs.version }} build - bash package.sh - - name: Upload deb - uses: actions/upload-artifact@v2.2.0 - with: - name: deb - path: steamguard-cli_${{ github.event.inputs.version }}-0.deb - # TODO: update AUR pkgbuild - draft: - needs: [build, deb-package] - runs-on: ubuntu-latest - steps: - - name: Download Build Artifact (tar) - uses: actions/download-artifact@v2.0.5 - with: - name: build - - name: Download Build Artifact (deb) - uses: actions/download-artifact@v2.0.5 - with: - name: deb - - name: Release Drafter - uses: release-drafter/release-drafter@v5.11.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - name: v${{ github.event.inputs.version }} - tag: v${{ github.event.inputs.version }} - version: ${{ github.event.inputs.version }} - publish: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f07ccef..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Release new version -on: - workflow_dispatch: - inputs: - version: - description: 'The version number to use' - default: '0.0.0.0' - # Input has to be provided for the workflow to run - required: true -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Validate version number - run: | - # validate version structure - bash -c '[[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 1' - # ensure version doesn't already exist - bash -c 'git rev-parse "v${{ github.event.inputs.version }}" >/dev/null 2>&1 && exit 2 || exit 0' - - name: Checkout - uses: actions/checkout@v2.3.3 - with: - submodules: true - - name: Install dependencies - run: sudo apt install nuget mono-complete make - - name: Update version number, and commit - run: | - git config --global user.name "Github Actions" - git config --global user.email "dyc3@users.noreply.github.com" - sed -ri "s/Version\(\"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\"\)/Version\(\"${{ github.event.inputs.version }}\"\)/g" AssemblyInfo.cs - git commit -m "Update version" AssemblyInfo.cs - - name: Build - run: | - nuget restore SteamAuth/SteamAuth/SteamAuth.sln - make - mv build steamguard-cli-v${{ github.event.inputs.version }} - tar -cf steamguard-cli-v${{ github.event.inputs.version }}.tar.gz steamguard-cli-v${{ github.event.inputs.version }} - - name: Tag and push version commit - run: | - git push origin master - git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}" - git push origin "v${{ github.event.inputs.version }}" - - name: Upload Build Artifact - uses: actions/upload-artifact@v2.2.0 - with: - name: build - path: steamguard-cli-v${{ github.event.inputs.version }}.tar.gz - deb-package: - runs-on: ubuntu-latest - needs: [build] - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - name: Download Build Artifact (tar) - uses: actions/download-artifact@v2.0.5 - with: - name: build - - run: | - tar -xf steamguard-cli-v${{ github.event.inputs.version }}.tar.gz - mv steamguard-cli-v${{ github.event.inputs.version }} build - bash package.sh - - name: Upload deb - uses: actions/upload-artifact@v2.2.0 - with: - name: deb - path: steamguard-cli_${{ github.event.inputs.version }}-0.deb - # TODO: update AUR pkgbuild - draft: - needs: [build, deb-package] - runs-on: ubuntu-latest - steps: - - name: Download Build Artifact (tar) - uses: actions/download-artifact@v2.0.5 - with: - name: build - - name: Download Build Artifact (deb) - uses: actions/download-artifact@v2.0.5 - with: - name: deb - - name: Release Drafter - uses: release-drafter/release-drafter@v5.11.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - name: v${{ github.event.inputs.version }} - tag: v${{ github.event.inputs.version }} - version: ${{ github.event.inputs.version }} - publish: false From 5d38ad84c77e45e500b9a87e8cc78f617a8cc80f Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 14 Nov 2021 12:21:09 -0500 Subject: [PATCH 2/5] remove gitmodules --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 0280bae..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "SteamAuth"] - path = SteamAuth - url = https://github.com/dyc3/SteamAuth.git From 2e96ca8f6e9cc9d1f9ed7d7958666d5326a3480a Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 14 Nov 2021 12:30:30 -0500 Subject: [PATCH 3/5] move aur publish to separate script --- scripts/full-release.sh | 14 ----------- scripts/publish-aur.sh | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 scripts/publish-aur.sh diff --git a/scripts/full-release.sh b/scripts/full-release.sh index 8f014b9..9d2f1e9 100755 --- a/scripts/full-release.sh +++ b/scripts/full-release.sh @@ -76,17 +76,3 @@ if [[ $DRY_RUN == false ]]; then fi gh release create "$VERSION" --title "$VERSION" --draft "$BIN_PATH" "./steamguard-cli_$RAW_VERSION-0.deb" fi - -# update PKGBUILD for AUR -if [[ -d "aur" ]]; then - rm -rf aur -fi -git clone ssh://aur@aur.archlinux.org/steamguard-cli-git.git aur -cp PKGBUILD aur/PKGBUILD -cd aur -git commit -m "release $VERSION" PKGBUILD -if [[ $DRY_RUN == false ]]; then - git push - rm -rf aur -fi -cd .. diff --git a/scripts/publish-aur.sh b/scripts/publish-aur.sh new file mode 100644 index 0000000..9f73e90 --- /dev/null +++ b/scripts/publish-aur.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +DRY_RUN=true + +POSITIONAL=() +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + --execute) + DRY_RUN=false + shift # past argument + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; + esac +done + +# prerequisites +if ! command -v makepkg &> /dev/null; then + echo "Error: makepkg is not installed" + exit 1 +fi +if ! command -v git &> /dev/null; then + echo "Error: git is not installed" + exit 2 +fi + + +# get version info +BIN_PATH="target/release/steamguard-cli" +RAW_VERSION="$("$BIN_PATH" --version | cut -d " " -f 2)" +TAGGED_VERSION="$(git tag | grep "^v" | tail -n 1 | tr -d v)" +if [[ "v$RAW_VERSION" != "v$TAGGED_VERSION" ]]; then + echo "Version mismatch: $RAW_VERSION != $TAGGED_VERSION" + exit 10 +fi +VERSION="v$RAW_VERSION" + +# update PKGBUILD for AUR +if [[ -d "aur" ]]; then + rm -rf aur +fi +git clone ssh://aur@aur.archlinux.org/steamguard-cli-git.git aur +cp PKGBUILD aur/PKGBUILD +cd aur +git commit -m "release $VERSION" PKGBUILD +if [[ $DRY_RUN == false ]]; then + git push + rm -rf aur +fi +cd .. \ No newline at end of file From 672e4bbce8b171249c90e10adce00fc29ef40dfc Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 14 Nov 2021 14:42:30 -0500 Subject: [PATCH 4/5] generate .SRCINFO --- scripts/publish-aur.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/publish-aur.sh b/scripts/publish-aur.sh index 9f73e90..6c5d4e5 100644 --- a/scripts/publish-aur.sh +++ b/scripts/publish-aur.sh @@ -47,6 +47,8 @@ fi git clone ssh://aur@aur.archlinux.org/steamguard-cli-git.git aur cp PKGBUILD aur/PKGBUILD cd aur +makepkg -si --noconfirm +makepkg --printsrcinfo > .SRCINFO git commit -m "release $VERSION" PKGBUILD if [[ $DRY_RUN == false ]]; then git push From 033ef7a4a1916438d01eb485be2c8ecdbabf2d7b Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 14 Nov 2021 14:42:57 -0500 Subject: [PATCH 5/5] add publish to AUR workflow --- .github/workflows/aur.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/aur.yml diff --git a/.github/workflows/aur.yml b/.github/workflows/aur.yml new file mode 100644 index 0000000..6baf077 --- /dev/null +++ b/.github/workflows/aur.yml @@ -0,0 +1,28 @@ +name: Publish to AUR + +on: + push: + branches: + - master + paths-ignore: + - '**/.gitignore' + - '.vscode/**' + - '**/*.md' + - 'scripts/full-release.sh' + - 'scripts/package-deb.sh' + - 'src/fixtures/**' +jobs: + publish-to-aur: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Archlinux + run: curl -L https://github.com/zaoqi/github-actions-archlinux/raw/master/install.sh | sh + - name: Install dependencies + run: sudo pacman -Syu --noconfirm base-devel git + - name: Configure git + run: | + git config --global user.email "{{ github.actor }}@users.noreply.github.com" + git config --global user.name "{{ github.actor }}" + - name: Publish to AUR + run: ./scripts/publish-aur.sh \ No newline at end of file