Skip to content

Commit fc29d0a

Browse files
committed
Generate asdf-pkl-aws-secret-resource-reader plugin from template.
1 parent d1c5fdb commit fc29d0a

File tree

15 files changed

+241
-86
lines changed

15 files changed

+241
-86
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
version: 2
22
updates:
3-
# dependabot for GitHub Actions for this repo
43
- package-ecosystem: "github-actions"
54
directory: "/"
65
schedule:
7-
interval: "weekly"
8-
# dependabot for GitHub Actions for the template
9-
- package-ecosystem: "github-actions"
10-
directory: "template/.github/"
11-
schedule:
12-
interval: "weekly"
6+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,16 @@ on:
77
pull_request:
88

99
jobs:
10-
test:
11-
name: template setup test
10+
plugin_test:
11+
name: asdf plugin test
1212
strategy:
1313
matrix:
1414
os:
1515
- ubuntu-latest
1616
- macos-latest
1717
runs-on: ${{ matrix.os }}
1818
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
- name: Run Template Setup
22-
run: |
23-
git config user.name "Foo Bearer"
24-
./setup.bash \
25-
"asdf-foo" \
26-
"foo --help" \
27-
"asdf-community" \
28-
"ASDF Community" \
29-
"https://github.com/asdf-vm/asdf" \
30-
"https://asdf-vm.com" \
31-
"Apache-2.0" \
32-
"yes"
33-
34-
- name: Check setup result
35-
run: |
36-
set -xe
37-
ls -la .
38-
git log
39-
test ! -d template/
40-
grep "Apache" LICENSE
41-
test "main" = "$(git rev-parse --abbrev-ref HEAD)"
42-
! git grep -F -e "<YOUR TOOL>" \
43-
--or -e "<TOOL HOMEPAGE>" \
44-
--or -e "<TOOL REPO>" \
45-
--or -e "<TOOL CHECK>" \
46-
--or -e "<YOUR NAME>" \
47-
--or -e"<YOUR GITHUB USERNAME>"
19+
- name: asdf_plugin_test
20+
uses: asdf-vm/actions/plugin-test@v2
21+
with:
22+
command: pkl-aws-secret-resource-reader --help

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: asdf-vm/actions/install@v3
13+
- uses: actions/checkout@v3
14+
- uses: asdf-vm/actions/install@v2
1515
- run: scripts/lint.bash
1616

1717
actionlint:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v3
2121
- name: Check workflow files
2222
uses: docker://rhysd/actionlint:1.6.23
2323
with:

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: GoogleCloudPlatform/release-please-action@v3
17+
with:
18+
release-type: simple

.github/workflows/semantic-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
semantic-pr:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: amannn/action-semantic-pull-request@v5.4.0
14+
- uses: amannn/action-semantic-pull-request@v5.2.0
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
with:

README.md

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,60 @@
1-
# asdf-plugin-template [![Build](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/build.yml/badge.svg)](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/build.yml) [![Lint](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/lint.yml/badge.svg)](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/lint.yml)
1+
<div align="center">
22

3-
This is an [asdf-vm plugin](https://asdf-vm.com/#/plugins-create) template with CI to run [Shellcheck](https://github.com/koalaman/shellcheck) and testing with the [asdf test GitHub Action](https://github.com/asdf-vm/actions).
3+
# asdf-pkl-aws-secret-resource-reader [![Build](https://github.com/infrablocks/asdf-pkl-aws-secret-resource-reader/actions/workflows/build.yml/badge.svg)](https://github.com/infrablocks/asdf-pkl-aws-secret-resource-reader/actions/workflows/build.yml) [![Lint](https://github.com/infrablocks/asdf-pkl-aws-secret-resource-reader/actions/workflows/lint.yml/badge.svg)](https://github.com/infrablocks/asdf-pkl-aws-secret-resource-reader/actions/workflows/lint.yml)
44

5-
## Usage
5+
[pkl-aws-secret-resource-reader](https://github.com/infrablocks/pkl-aws-secret-resource-reader) plugin for the [asdf version manager](https://asdf-vm.com).
66

7-
1. [Generate](https://github.com/asdf-vm/asdf-plugin-template/generate) a new repository based on this template.
8-
1. Clone it and run `bash setup.bash`.
9-
1. Force push to your repo: `git push --force-with-lease`.
10-
1. Adapt your code at the TODO markers. To find the markers: `git grep TODO`.
11-
1. To develop your plugin further, please read [the plugins create section of the docs](https://asdf-vm.com/plugins/create.html).
7+
</div>
128

13-
>A feature of this plugin-template when hosted on GitHub is the use of [release-please](https://github.com/googleapis/release-please), an automated release tool. It leverages [Conventional Commit messages](https://www.conventionalcommits.org/) to determine semver release type, see the [documentation](https://github.com/googleapis/release-please).
9+
# Contents
1410

15-
## Contributing
11+
- [Dependencies](#dependencies)
12+
- [Install](#install)
13+
- [Contributing](#contributing)
14+
- [License](#license)
1615

17-
Contributions welcome!
16+
# Dependencies
1817

19-
1. Install `asdf` tools
18+
**TODO: adapt this section**
2019

21-
```shell
22-
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git
23-
asdf plugin add shfmt https://github.com/luizm/asdf-shfmt.git
24-
asdf install
25-
```
20+
- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
21+
- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x.
2622

27-
1. Develop!
23+
# Install
2824

29-
1. Lint & Format
25+
Plugin:
3026

31-
```shell
32-
./scripts/format.bash
33-
./scripts/lint.bash
34-
```
27+
```shell
28+
asdf plugin add pkl-aws-secret-resource-reader
29+
# or
30+
asdf plugin add pkl-aws-secret-resource-reader https://github.com/infrablocks/asdf-pkl-aws-secret-resource-reader.git
31+
```
3532

36-
1. PR changes
33+
pkl-aws-secret-resource-reader:
34+
35+
```shell
36+
# Show all installable versions
37+
asdf list-all pkl-aws-secret-resource-reader
38+
39+
# Install specific version
40+
asdf install pkl-aws-secret-resource-reader latest
41+
42+
# Set a version globally (on your ~/.tool-versions file)
43+
asdf global pkl-aws-secret-resource-reader latest
44+
45+
# Now pkl-aws-secret-resource-reader commands are available
46+
pkl-aws-secret-resource-reader --help
47+
```
48+
49+
Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to
50+
install & manage versions.
51+
52+
# Contributing
53+
54+
Contributions of any kind welcome! See the [contributing guide](contributing.md).
55+
56+
[Thanks goes to these contributors](https://github.com/infrablocks/asdf-pkl-aws-secret-resource-reader/graphs/contributors)!
57+
58+
# License
59+
60+
See [LICENSE](LICENSE) © [Tom Duckering](https://github.com/infrablocks/)

bin/download

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
current_script_path=${BASH_SOURCE[0]}
6+
plugin_dir=$(dirname "$(dirname "$current_script_path")")
7+
8+
# shellcheck source=./lib/utils.bash
9+
source "${plugin_dir}/lib/utils.bash"
10+
11+
mkdir -p "$ASDF_DOWNLOAD_PATH"
12+
13+
# TODO: Adapt this to proper extension and adapt extracting strategy.
14+
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
15+
16+
# Download tar.gz file to the download directory
17+
download_release "$ASDF_INSTALL_VERSION" "$release_file"
18+
19+
# Extract contents of tar.gz file into the download directory
20+
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"
21+
22+
# Remove the tar.gz file since we don't need to keep it
23+
rm "$release_file"

bin/install

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
current_script_path=${BASH_SOURCE[0]}
6+
plugin_dir=$(dirname "$(dirname "$current_script_path")")
7+
8+
# shellcheck source=./lib/utils.bash
9+
source "${plugin_dir}/lib/utils.bash"
10+
11+
install_version "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"

bin/latest-stable

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
current_script_path=${BASH_SOURCE[0]}
6+
plugin_dir=$(dirname "$(dirname "$current_script_path")")
7+
8+
# shellcheck source=./lib/utils.bash
9+
. "${plugin_dir}/lib/utils.bash"
10+
11+
curl_opts=(-sI)
12+
13+
if [ -n "${GITHUB_API_TOKEN:-}" ]; then
14+
curl_opts=("${curl_opts[@]}" -H "Authorization: token $GITHUB_API_TOKEN")
15+
fi
16+
17+
# curl of REPO/releases/latest is expected to be a 302 to another URL
18+
# when no releases redirect_url="REPO/releases"
19+
# when there are releases redirect_url="REPO/releases/tag/v<VERSION>"
20+
redirect_url=$(curl "${curl_opts[@]}" "$GH_REPO/releases/latest" | sed -n -e "s|^location: *||p" | sed -n -e "s|\r||p")
21+
version=
22+
printf "redirect url: %s\n" "$redirect_url" >&2
23+
if [[ "$redirect_url" == "$GH_REPO/releases" ]]; then
24+
version="$(list_all_versions | sort_versions | tail -n1 | xargs echo)"
25+
else
26+
version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||')"
27+
fi
28+
29+
printf "%s\n" "$version"

bin/list-all

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
current_script_path=${BASH_SOURCE[0]}
6+
plugin_dir=$(dirname "$(dirname "$current_script_path")")
7+
8+
# shellcheck source=./lib/utils.bash
9+
source "${plugin_dir}/lib/utils.bash"
10+
11+
list_all_versions | sort_versions | xargs echo

0 commit comments

Comments
 (0)