diff --git a/.github/workflows/release-old.yml b/.github/workflows/release-old.yml new file mode 100644 index 0000000..f07ccef --- /dev/null +++ b/.github/workflows/release-old.yml @@ -0,0 +1,88 @@ +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/Cargo.lock b/Cargo.lock index 24f231d..bc15b9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1826,7 +1826,7 @@ checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" [[package]] name = "steamguard" -version = "0.1.0" +version = "0.4.0" dependencies = [ "anyhow", "base64", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "steamguard-cli" -version = "0.2.0" +version = "0.4.0" dependencies = [ "aes", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index e6d2daa..03ec7ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,13 @@ members = [ [package] name = "steamguard-cli" -version = "0.2.0" +version = "0.4.0" authors = ["Carson McManus "] edition = "2018" +description = "A command line utility to generate Steam 2FA codes and respond to confirmations." +keywords = ["steam", "2fa", "steamguard", "authentication", "cli"] +categories = ["command-line-utilities"] +repository = "https://github.com/dyc3/steamguard-cli" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/package.sh b/package.sh index e37267d..e9e8487 100755 --- a/package.sh +++ b/package.sh @@ -1,29 +1,33 @@ #!/bin/bash -VERSION=$(build/steamguard --help | head -n 1 | cut -d v -f 2)"-0" +BIN_PATH="target/steamguard-cli" +if [[ ! -f "${BIN_PATH}" ]]; then + echo "ERROR: Could not find release binaries, building them..." + cargo build --release +fi +VERSION=$("$BIN_PATH" --version | cut -d " " -f 2)"-0" TEMP_PKG_PATH="/tmp/steamguard-cli_$VERSION" -echo Building Debian package for v$VERSION... +echo "Building Debian package for v$VERSION..." -mkdir -p $TEMP_PKG_PATH/usr/local/bin -mkdir -p $TEMP_PKG_PATH/etc/bash_completion.d -mkdir -p $TEMP_PKG_PATH/DEBIAN +mkdir -p "$TEMP_PKG_PATH/usr/local/bin" +mkdir -p "$TEMP_PKG_PATH/etc/bash_completion.d" +mkdir -p "$TEMP_PKG_PATH/DEBIAN" -cp build/* $TEMP_PKG_PATH/usr/local/bin -cp bash-tab-completion $TEMP_PKG_PATH/etc/bash_completion.d/steamguard +cp "$BIN_PATH" "$TEMP_PKG_PATH/usr/local/bin/steamguard" +"$BIN_PATH" completion --shell bash > "$TEMP_PKG_PATH/etc/bash_completion.d/steamguard" cat <> $TEMP_PKG_PATH/DEBIAN/control Package: steamguard-cli -Depends: mono-complete +Depends: Version: $VERSION Section: base Priority: optional Architecture: all -Maintainer: Carson McManus +Maintainer: Carson McManus Description: steamguard-cli - A command line utility to generate Steam Guard codes - (AKA 2 factor authentication codes). + A command line utility to generate Steam 2FA codes and respond to confirmations. EOT -dpkg-deb --build $TEMP_PKG_PATH steamguard-cli_$VERSION.deb +dpkg-deb --build "$TEMP_PKG_PATH" "steamguard-cli_$VERSION.deb" -rm -rf $TEMP_PKG_PATH +rm -rf "$TEMP_PKG_PATH" diff --git a/steamguard/Cargo.toml b/steamguard/Cargo.toml index 4392228..86624e9 100644 --- a/steamguard/Cargo.toml +++ b/steamguard/Cargo.toml @@ -1,8 +1,10 @@ [package] name = "steamguard" -version = "0.1.0" +version = "0.4.0" +authors = ["Carson McManus "] edition = "2018" description = "Library for generating 2fa codes for Steam and responding to mobile confirmations." +keywords = ["steam", "2fa", "steamguard", "authentication"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html