Merge pull request #33 from tsuyoshicho/feature/remotetags-20210214
Add support tag checker
This commit is contained in:
24
.github/workflows/depup.yml
vendored
24
.github/workflows/depup.yml
vendored
@@ -53,3 +53,27 @@ jobs:
|
|||||||
|
|
||||||
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
|
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
|
||||||
branch: depup/${{ steps.depup.outputs.repo }}
|
branch: depup/${{ steps.depup.outputs.repo }}
|
||||||
|
|
||||||
|
themis:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./
|
||||||
|
id: depup
|
||||||
|
with:
|
||||||
|
file: testdata/testfile
|
||||||
|
version_name: THEMIS_VERSION
|
||||||
|
repo: thinca/vim-themis
|
||||||
|
tag: true
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
title: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
|
||||||
|
commit-message: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
|
||||||
|
body: |
|
||||||
|
Update ${{ steps.depup.outputs.repo }} to [${{ steps.depup.outputs.latest }}](https://github.com/${{ steps.depup.outputs.repo }}/releases/tag/v${{ steps.depup.outputs.latest }})
|
||||||
|
|
||||||
|
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
|
||||||
|
branch: depup/${{ steps.depup.outputs.repo }}
|
||||||
|
|||||||
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
@@ -61,3 +61,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Check diff
|
- name: Check diff
|
||||||
run: git diff
|
run: git diff
|
||||||
|
|
||||||
|
tagged_version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./
|
||||||
|
id: depup
|
||||||
|
with:
|
||||||
|
file: testdata/testfile
|
||||||
|
version_name: THEMIS_VERSION
|
||||||
|
repo: thinca/vim-themis
|
||||||
|
tag: true
|
||||||
|
|
||||||
|
- name: Check diff
|
||||||
|
run: git diff
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ inputs:
|
|||||||
repo:
|
repo:
|
||||||
description: 'target GitHub repository. e.g. reviewdog/reviewdog'
|
description: 'target GitHub repository. e.g. reviewdog/reviewdog'
|
||||||
required: true
|
required: true
|
||||||
|
tag:
|
||||||
|
description: 'Check tags instead of releases.'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ inputs:
|
|||||||
repo:
|
repo:
|
||||||
description: 'target GitHub repository. e.g. reviewdog/reviewdog'
|
description: 'target GitHub repository. e.g. reviewdog/reviewdog'
|
||||||
required: true
|
required: true
|
||||||
|
tag:
|
||||||
|
description: 'Check tags instead of releases.'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
|
|||||||
@@ -27,13 +27,23 @@ list_releases() {
|
|||||||
curl -s "https://api.github.com/repos/${REPO}/releases"
|
curl -s "https://api.github.com/repos/${REPO}/releases"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Return version list from tags(refs/tags/vA.B.C and vA.B.C^{}) or releases
|
||||||
|
list_versions() {
|
||||||
|
if [ "${INPUT_TAG:-false}" = "true" ]; then
|
||||||
|
git ls-remote -q --tags "https://github.com/${REPO}.git" | awk '{ print $2 }'
|
||||||
|
else
|
||||||
|
list_releases | jq -r '.[] | .tag_name'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
LATEST_VERSION="$(\
|
LATEST_VERSION="$(\
|
||||||
list_releases | \
|
list_versions | \
|
||||||
jq -r '.[] | .tag_name' | \
|
grep -oP '\d+(\.\d+)+(-[^'\''\"\s]*)?$'| \
|
||||||
grep -oP '\d+\.\d+(\.\d+)?(-[^'\''\"\s]*)?$' | \
|
|
||||||
sort --version-sort --reverse | \
|
sort --version-sort --reverse | \
|
||||||
head -n1 \
|
head -n1 \
|
||||||
)"
|
)"
|
||||||
|
|
||||||
if [ -z "${LATEST_VERSION}" ]; then
|
if [ -z "${LATEST_VERSION}" ]; then
|
||||||
echo "cannot get latest ${REPO} version"
|
echo "cannot get latest ${REPO} version"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
2
testdata/testfile
vendored
2
testdata/testfile
vendored
@@ -39,3 +39,5 @@ TMUX_VERSION=3.0
|
|||||||
|
|
||||||
POETRY_VERSION="1.1.3"
|
POETRY_VERSION="1.1.3"
|
||||||
ENV POETRY_VERSION='1.1.3'
|
ENV POETRY_VERSION='1.1.3'
|
||||||
|
|
||||||
|
THEMIS_VERSION=1.5
|
||||||
|
|||||||
Reference in New Issue
Block a user