From 0a3a2b10edd5bf3f1dd51e83f296d24b080f4fdb Mon Sep 17 00:00:00 2001 From: Rob Fletcher Date: Thu, 12 Sep 2024 20:57:12 -0700 Subject: [PATCH] Added required secret --- .github/workflows/ci.yml | 4 -- README.md | 129 ++------------------------------------- script/release | 126 -------------------------------------- 3 files changed, 4 insertions(+), 255 deletions(-) delete mode 100755 script/release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98997a6..0f0fe1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,3 @@ jobs: uses: ./ with: api-key: ${{ secrets.GEODESIC_API_KEY }} - - - name: Print Output - id: output - run: echo "${{ steps.test-action.outputs.time }}" diff --git a/README.md b/README.md index 23d3ed5..6bbf15f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# Geodesic Auth Action + +authenticate geodesic + ## Initial Setup After you've cloned the repository to your local machine or codespace, you'll @@ -39,128 +43,3 @@ need to perform some initial setup steps before you can develop your action. ... ``` -So, what are you waiting for? Go ahead and start customizing your action! - -1. Create a new branch - - ```bash - git checkout -b releases/v1 - ``` - -1. Replace the contents of `src/` with your action code -1. Add tests to `__tests__/` for your source code -1. Format, test, and build the action - - ```bash - npm run all - ``` - - > This step is important! It will run [`ncc`](https://github.com/vercel/ncc) - > to build the final JavaScript action code with all dependencies included. - > If you do not run this step, your action will not work correctly when it is - > used in a workflow. This step also includes the `--license` option for - > `ncc`, which will create a license file for all of the production node - > modules used in your project. - -1. Commit your changes - - ```bash - git add . - git commit -m "My first action is ready!" - ``` - -1. Push them to your repository - - ```bash - git push -u origin releases/v1 - ``` - -1. Create a pull request and get feedback on your action -1. Merge the pull request into the `main` branch - -Your action is now published! :rocket: - -For information about versioning your action, see -[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) -in the GitHub Actions toolkit. - -## Validate the Action - -You can now validate the action by referencing it in a workflow file. For -example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an -action in the same repository. - -```yaml -steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - - name: Test Local Action - id: test-action - uses: ./ - with: - milliseconds: 1000 - - - name: Print Output - id: output - run: echo "${{ steps.test-action.outputs.time }}" -``` - -For example workflow runs, check out the -[Actions tab](https://github.com/actions/typescript-action/actions)! :rocket: - -## Usage - -After testing, you can create version tag(s) that developers can use to -reference different stable versions of your action. For more information, see -[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) -in the GitHub Actions toolkit. - -To include the action in a workflow in another repository, you can use the -`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit -hash. - -```yaml -steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - - name: Test Local Action - id: test-action - uses: actions/typescript-action@v1 # Commit with the `v1` tag - with: - milliseconds: 1000 - - - name: Print Output - id: output - run: echo "${{ steps.test-action.outputs.time }}" -``` - -## Publishing a New Release - -This project includes a helper script, [`script/release`](./script/release) -designed to streamline the process of tagging and pushing new releases for -GitHub Actions. - -GitHub Actions allows users to select a specific version of the action to use, -based on release tags. This script simplifies this process by performing the -following steps: - -1. **Retrieving the latest release tag:** The script starts by fetching the most - recent SemVer release tag of the current branch, by looking at the local data - available in your repository. -1. **Prompting for a new release tag:** The user is then prompted to enter a new - release tag. To assist with this, the script displays the tag retrieved in - the previous step, and validates the format of the inputted tag (vX.X.X). The - user is also reminded to update the version field in package.json. -1. **Tagging the new release:** The script then tags a new release and syncs the - separate major tag (e.g. v1, v2) with the new release tag (e.g. v1.0.0, - v2.1.2). When the user is creating a new major release, the script - auto-detects this and creates a `releases/v#` branch for the previous major - version. -1. **Pushing changes to remote:** Finally, the script pushes the necessary - commits, tags and branches to the remote repository. From here, you will need - to create a new release in GitHub so users can easily reference the new tags - in their workflows. diff --git a/script/release b/script/release deleted file mode 100755 index 9e23fd2..0000000 --- a/script/release +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -# Exit early -# See: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#The-Set-Builtin -set -e - -# About: -# -# This is a helper script to tag and push a new release. GitHub Actions use -# release tags to allow users to select a specific version of the action to use. -# -# See: https://github.com/actions/typescript-action#publishing-a-new-release -# See: https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations -# -# This script will do the following: -# -# 1. Retrieve the latest release tag -# 2. Display the latest release tag -# 3. Prompt the user for a new release tag -# 4. Validate the new release tag -# 5. Remind user to update the version field in package.json -# 6. Tag a new release -# 7. Set 'is_major_release' variable -# 8. Point separate major release tag (e.g. v1, v2) to the new release -# 9. Push the new tags (with commits, if any) to remote -# 10. If this is a major release, create a 'releases/v#' branch and push -# -# Usage: -# -# script/release - -# Variables -semver_tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$' -semver_tag_glob='v[0-9].[0-9].[0-9]*' -git_remote='origin' -major_semver_tag_regex='\(v[0-9]*\)' - -# Terminal colors -OFF='\033[0m' -BOLD_RED='\033[1;31m' -BOLD_GREEN='\033[1;32m' -BOLD_BLUE='\033[1;34m' -BOLD_PURPLE='\033[1;35m' -BOLD_UNDERLINED='\033[1;4m' -BOLD='\033[1m' - -# 1. Retrieve the latest release tag -if ! latest_tag=$(git describe --abbrev=0 --match="$semver_tag_glob"); then - # There are no existing release tags - echo -e "No tags found (yet) - Continue to create and push your first tag" - latest_tag="[unknown]" -fi - -# 2. Display the latest release tag -echo -e "The latest release tag is: ${BOLD_BLUE}${latest_tag}${OFF}" - -# 3. Prompt the user for a new release tag -read -r -p 'Enter a new release tag (vX.X.X format): ' new_tag - -# 4. Validate the new release tag -if echo "$new_tag" | grep -q -E "$semver_tag_regex"; then - # Release tag is valid - echo -e "Tag: ${BOLD_BLUE}$new_tag${OFF} is valid syntax" -else - # Release tag is not in `vX.X.X` format - echo -e "Tag: ${BOLD_BLUE}$new_tag${OFF} is ${BOLD_RED}not valid${OFF} (must be in ${BOLD}vX.X.X${OFF} format)" - exit 1 -fi - -# 5. Remind user to update the version field in package.json -echo -e -n "Make sure the version field in package.json is ${BOLD_BLUE}$new_tag${OFF}. Yes? [Y/${BOLD_UNDERLINED}n${OFF}] " -read -r YN - -if [[ ! ($YN == "y" || $YN == "Y") ]]; then - # Package.json version field is not up to date - echo -e "Please update the package.json version to ${BOLD_PURPLE}$new_tag${OFF} and commit your changes" - exit 1 -fi - -# 6. Tag a new release -git tag "$new_tag" --annotate --message "$new_tag Release" -echo -e "Tagged: ${BOLD_GREEN}$new_tag${OFF}" - -# 7. Set 'is_major_release' variable -latest_major_release_tag=$(expr "$latest_tag" : "$major_semver_tag_regex") -new_major_release_tag=$(expr "$new_tag" : "$major_semver_tag_regex") - -if ! [[ "$new_major_release_tag" = "$latest_major_release_tag" ]]; then - is_major_release='yes' -else - is_major_release='no' -fi - -# 8. Point separate major release tag (e.g. v1, v2) to the new release -if [ $is_major_release = 'yes' ]; then - # Create a new major verison tag and point it to this release - git tag "$new_major_release_tag" --annotate --message "$new_major_release_tag Release" - echo -e "New major version tag: ${BOLD_GREEN}$new_major_release_tag${OFF}" -else - # Update the major verison tag to point it to this release - git tag "$latest_major_release_tag" --force --annotate --message "Sync $latest_major_release_tag tag with $new_tag" - echo -e "Synced ${BOLD_GREEN}$latest_major_release_tag${OFF} with ${BOLD_GREEN}$new_tag${OFF}" -fi - -# 9. Push the new tags (with commits, if any) to remote -git push --follow-tags - -if [ $is_major_release = 'yes' ]; then - # New major version tag is pushed with the '--follow-tags' flags - echo -e "Tags: ${BOLD_GREEN}$new_major_release_tag${OFF} and ${BOLD_GREEN}$new_tag${OFF} pushed to remote" -else - # Force push the updated major version tag - git push $git_remote "$latest_major_release_tag" --force - echo -e "Tags: ${BOLD_GREEN}$latest_major_release_tag${OFF} and ${BOLD_GREEN}$new_tag${OFF} pushed to remote" -fi - -# 10. If this is a major release, create a 'releases/v#' branch and push -if [ $is_major_release = 'yes' ]; then - git branch "releases/$latest_major_release_tag" "$latest_major_release_tag" - echo -e "Branch: ${BOLD_BLUE}releases/$latest_major_release_tag${OFF} created from ${BOLD_BLUE}$latest_major_release_tag${OFF} tag" - git push --set-upstream $git_remote "releases/$latest_major_release_tag" - echo -e "Branch: ${BOLD_GREEN}releases/$latest_major_release_tag${OFF} pushed to remote" -fi - -# Completed -echo -e "${BOLD_GREEN}Done!${OFF}"