From 4d1983388bf5e06a05ed6c9b5e6b995ef28e6c7b Mon Sep 17 00:00:00 2001 From: Ahmad Husen Date: Fri, 1 Oct 2021 22:27:55 +0700 Subject: [PATCH] feat: update pkgver --- .github/workflows/main.yml | 6 ++++-- README.md | 1 + action.yml | 5 +++++ entrypoint.sh | 8 ++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a308389..23db7e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,11 +25,12 @@ jobs: cat action.yml - name: Get sample PKGBUILD - run: wget https://github.com/datakrama/nonicons-font/raw/main/PKGBUILD + run: wget https://github.com/datakrama/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD - name: Running test uses: ./ with: + pkgver: '0.4.26' updpkgsums: true srcinfo: true @@ -93,7 +94,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Get sample PKGBUILD - run: wget https://github.com/datakrama/nonicons-font/raw/main/PKGBUILD + run: wget https://github.com/datakrama/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD - name: Update action.yml to use edge tagged container image if: github.ref == 'refs/heads/main' @@ -104,6 +105,7 @@ jobs: - name: Running test uses: ./ with: + pkgver: '0.4.26' updpkgsums: true srcinfo: true diff --git a/README.md b/README.md index b528c8c..ff178ce 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Following inputs can be used as `step.with` keys | Name | Type | Default | Required | Description | |-------------------|-----------|-------------------------------|-----------|---------------------------------------| | `path` | String | | `false` | Path where PKGBUILD is located. This path always located under $GITHUB_WORKSPACE | +| `pkgver` | String | | `false` | Update `pkgver` on your PKGBUILD | | `updpkgsums` | Boolean | `false` | `false` | Update checksums on your PKGBUILD | | `srcinfo` | Boolean | `false` | `false` | Generate new .SRCINFO | | `namcap` | Boolean | `true` | `false` | Validate PKGBUILD | diff --git a/action.yml b/action.yml index 835b4a6..4755195 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: description: 'Location for this action to run' default: '' required: false + pkgver: + description: 'Update pkgver on PKGBUILD' + default: '' + required: false updpkgsums: description: 'Update checksums on PKGBUILD' default: 'false' @@ -33,6 +37,7 @@ runs: image: 'docker://ghcr.io/datakrama/archlinux-package-action:1' args: - ${{ inputs.path }} + - ${{ inputs.pkgver }} - ${{ inputs.updpkgsums }} - ${{ inputs.srcinfo }} - ${{ inputs.flags }} diff --git a/entrypoint.sh b/entrypoint.sh index fa2979d..2f76a4a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,6 +11,14 @@ sudo -u builder cp -fv "$WORKPATH"/PKGBUILD /tmp/gh-action/PKGBUILD cd /tmp/gh-action echo "::endgroup::" +# Update pkgver +if [[ -n $INPUT_PKGVER ]]; then + echo "::group::Updating pkgver on PKGBUILD" + sed -i "s:^pkgver=.*$:pkgver=$INPUT_PKGVER:g" PKGBUILD + git diff PKGBUILD + echo "::endgroup::" +fi + # Update checksums if [[ $INPUT_UPDPKGSUMS == true ]]; then echo "::group::Updating checksums on PKGBUILD"