From 3f3d055e90e8d59b1b0d3bc149cdaa58b17ac98d Mon Sep 17 00:00:00 2001 From: Jacob Magnusson Date: Sat, 30 Jul 2022 11:48:15 +0200 Subject: [PATCH] chore: Initial commit Release-As: 0.1.0 --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + LICENSE | 21 +++++++++++++++++++ README.md | 3 +++ action.yml | 15 +++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 action.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..9dde623 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,43 @@ +on: + push: + branches: + - main + +env: + ACTION_NAME: setup-age-action + +name: Main +jobs: + test: + runs-on: ubuntu-latest + name: Test action + steps: + - uses: actions/checkout@v3 + # NOTE: Obviously, `main` might refer to a different commit if one is pushed just + # after the relevant commit was made. Unfortunately one cannot use `github.sha` + # in `uses`. + - uses: jacobsvante/setup-age-action@main + - run: | + echo 'Shhh!' > my-secret.txt + AGE_PUBKEY=$(age-keygen --output key.txt 2>&1 | cut -d' ' -f3) + echo $AGE_PUBKEY + TEST_OUTPUT=$(cat my-secret.txt | age --encrypt --recipient $AGE_PUBKEY --armor | age --decrypt --identity key.txt) + [[ $(echo "$TEST_OUTPUT") == 'Shhh!' ]] + shell: bash + release-please: + runs-on: ubuntu-latest + needs: [test] + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: simple + package-name: ${{ env.ACTION_NAME }} + bump-minor-pre-major: true + - uses: actions/checkout@v3 + - name: Tag major and minor versions in Git + if: ${{ steps.release.outputs.release_created }} + uses: jacobsvante/tag-major-minor-action@v0 + with: + major: ${{ steps.release.outputs.major }} + minor: ${{ steps.release.outputs.minor }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3819fed --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jacob Magnusson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..780c96a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# setup-age-action + +Make age (https://github.com/FiloSottile/age) available to your Github actions. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..6be5441 --- /dev/null +++ b/action.yml @@ -0,0 +1,15 @@ +name: Setup age +description: Download and make age (and age-keygen) available +inputs: + version: + description: The `age` version to use + required: true + default: "1.0.0" +runs: + using: composite + steps: + - shell: bash + run: | + curl -Lo age.tar.gz https://github.com/FiloSottile/age/releases/download/v${{ inputs.version }}/age-v${{ inputs.version }}-linux-amd64.tar.gz + tar xvf age.tar.gz && rm age.tar.gz + echo "$(pwd)/age" >> $GITHUB_PATH