From a84c610bd47a33aff52aa6f157e3107f0a8c16b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=ADdac=20Coll?= Date: Wed, 16 Nov 2022 10:34:40 +0100 Subject: [PATCH] feat: Initial commit. --- .circleci/config.yml | 35 ++++++++++++++++ .circleci/test-deploy.yml | 40 ++++++++++++++++++ .github/ISSUE_TEMPLATE/BUG.yml | 41 +++++++++++++++++++ .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 34 +++++++++++++++ .github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md | 25 +++++++++++ .gitignore | 3 ++ .yamllint | 7 ++++ LICENSE | 21 ++++++++++ README.md | 39 ++++++++++++++++++ src/@orb.yml | 15 +++++++ src/README.md | 26 ++++++++++++ src/commands/greet.yml | 15 +++++++ src/examples/example.yml | 13 ++++++ src/executors/default.yml | 12 ++++++ src/jobs/hello.yml | 14 +++++++ src/scripts/greet.sh | 2 + 16 files changed, 342 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .circleci/test-deploy.yml create mode 100644 .github/ISSUE_TEMPLATE/BUG.yml create mode 100644 .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md create mode 100644 .gitignore create mode 100644 .yamllint create mode 100644 LICENSE create mode 100644 README.md create mode 100755 src/@orb.yml create mode 100644 src/README.md create mode 100755 src/commands/greet.yml create mode 100755 src/examples/example.yml create mode 100755 src/executors/default.yml create mode 100755 src/jobs/hello.yml create mode 100644 src/scripts/greet.sh diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..de5bfe0 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,35 @@ +version: 2.1 +setup: true +orbs: + orb-tools: circleci/orb-tools@11.1 + shellcheck: circleci/shellcheck@3.1 + +filters: &filters + tags: + only: /.*/ + +workflows: + lint-pack: + jobs: + - orb-tools/lint: + filters: *filters + - orb-tools/pack: + filters: *filters + - orb-tools/review: + filters: *filters + - shellcheck/check: + filters: *filters + - orb-tools/publish: + orb-name: qustodio-github/github-actions-orb + vcs-type: << pipeline.project.type >> + requires: + [orb-tools/lint, orb-tools/review, orb-tools/pack, shellcheck/check] + # Use a context to hold your publishing token. + context: orb-publishing + filters: *filters + # Triggers the next workflow in the Orb Development Kit. + - orb-tools/continue: + pipeline-number: << pipeline.number >> + vcs-type: << pipeline.project.type >> + requires: [orb-tools/publish] + filters: *filters diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml new file mode 100644 index 0000000..b213219 --- /dev/null +++ b/.circleci/test-deploy.yml @@ -0,0 +1,40 @@ +version: 2.1 +orbs: + github-actions-orb: qustodio-github/github-actions-orb@dev:<> + orb-tools: circleci/orb-tools@11.1 + +filters: &filters + tags: + only: /.*/ + +jobs: + # Create a job to test the commands of your orbs. + # You may want to add additional validation steps to ensure the commands are working as expected. + command-tests: + docker: + - image: cimg/base:current + steps: + - checkout + # Run your orb's commands to validate them. + - github-actions-orb/greet +workflows: + test-deploy: + jobs: + # Make sure to include "filters: *filters" in every test job you want to run as part of your deployment. + - command-tests: + filters: *filters + - orb-tools/pack: + filters: *filters + - orb-tools/publish: + orb-name: qustodio-github/github-actions-orb + vcs-type: << pipeline.project.type >> + pub-type: production + requires: + - orb-tools/pack + - command-tests + context: orb-publishing + filters: + branches: + ignore: /.*/ + tags: + only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml new file mode 100644 index 0000000..7959796 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG.yml @@ -0,0 +1,41 @@ +name: "\U0001F41E Bug Report" +description: Report any identified bugs. +title: 'Bug: ' +labels: [bug] +# assignees: '' +body: + - type: checkboxes + attributes: + label: "Is there an existing issue for this?" + description: "Please search [here](https://github.com///issues?q=is%3Aissue) to see if an issue already exists for the bug you encountered" + options: + - label: "I have searched the existing issues" + required: true + + - type: input + attributes: + label: "Orb version" + description: | + Which version of `/` are you using? + placeholder: "1.0.0" + + - type: textarea + validations: + required: true + attributes: + label: "Current behavior" + description: "How does the issue manifest?" + + - type: textarea + validations: + required: true + attributes: + label: "Minimum reproduction config" + description: "Enter a URL to a failed build or write a config example to reproduce the issue" + placeholder: "https://app.circleci.com/..." + + - type: textarea + attributes: + label: "Other" + description: | + Anything else you want to share? diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml new file mode 100644 index 0000000..864fd10 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -0,0 +1,34 @@ +name: "\U0001F4A1 Feature Request" +description: Have an idea for a new feature? Begin by submitting a Feature Request +title: 'Request: ' +labels: [enhancement] +# assignees: '' +body: + - type: checkboxes + attributes: + label: "Is there an existing issue that is already proposing this?" + description: "Please search [here](https://github.com/CircleCI-Public/circleci-config-sdk-ts/issues?q=is%3Aissue) to see if an issue already exists for the feature you are requesting" + options: + - label: "I have searched the existing issues" + required: true + + - type: textarea + validations: + required: true + attributes: + label: "Describe the problem imposed by not having this feature" + description: "Please describe the use-case you are attempting to implement, and the current limitations you are facing." + + - type: textarea + validations: + required: true + attributes: + label: "Describe the solution you'd like" + description: "A clear and concise description of what you want to happen. Add any considered drawbacks" + + + - type: textarea + attributes: + label: "Other" + description: | + Anything else you want to share? \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md new file mode 100644 index 0000000..6b802b2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md @@ -0,0 +1,25 @@ +## PR Type +What kind of change does this PR introduce? + + +- [ ] Bugfix +- [ ] Feature +- [ ] Code style update (formatting) +- [ ] Refactoring (no functional changes) +- [ ] CI related changes +- [ ] Other... Please describe: + +## What is the current behavior? + + +Issue Number: N/A + +## What is the new behavior? + +## Does this PR introduce a breaking change? +- [ ] Yes +- [ ] No + + + +## Other information diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c88c1b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# orb.yml is "packed" from source, and not published directly from the repository. +orb.yml +.DS_Store \ No newline at end of file diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..c9a8a2e --- /dev/null +++ b/.yamllint @@ -0,0 +1,7 @@ +extends: relaxed + +rules: + line-length: + max: 200 + allow-non-breakable-inline-mappings: true + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b32d28e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 + +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..9098ecc --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# Orb Template + + +[![CircleCI Build Status](https://circleci.com/gh/qustodio/github-actions-orb.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/qustodio/github-actions-orb) [![CircleCI Orb Version](https://badges.circleci.com/orbs/qustodio-github/github-actions-orb.svg)](https://circleci.com/orbs/registry/orb/qustodio-github/github-actions-orb) [![GitHub License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/qustodio/github-actions-orb/master/LICENSE) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs) + + + +A project template for Orbs. + +This repository is designed to be automatically ingested and modified by the CircleCI CLI's `orb init` command. + +_**Edit this area to include a custom title and description.**_ + +--- + +## Resources + +[CircleCI Orb Registry Page](https://circleci.com/orbs/registry/orb/qustodio-github/github-actions-orb) - The official registry page of this orb for all versions, executors, commands, and jobs described. + +[CircleCI Orb Docs](https://circleci.com/docs/2.0/orb-intro/#section=configuration) - Docs for using, creating, and publishing CircleCI Orbs. + +### How to Contribute + +We welcome [issues](https://github.com/qustodio/github-actions-orb/issues) to and [pull requests](https://github.com/qustodio/github-actions-orb/pulls) against this repository! + +### How to Publish An Update +1. Merge pull requests with desired changes to the main branch. + - For the best experience, squash-and-merge and use [Conventional Commit Messages](https://conventionalcommits.org/). +2. Find the current version of the orb. + - You can run `circleci orb info qustodio-github/github-actions-orb | grep "Latest"` to see the current version. +3. Create a [new Release](https://github.com/qustodio/github-actions-orb/releases/new) on GitHub. + - Click "Choose a tag" and _create_ a new [semantically versioned](http://semver.org/) tag. (ex: v1.0.0) + - We will have an opportunity to change this before we publish if needed after the next step. +4. Click _"+ Auto-generate release notes"_. + - This will create a summary of all of the merged pull requests since the previous release. + - If you have used _[Conventional Commit Messages](https://conventionalcommits.org/)_ it will be easy to determine what types of changes were made, allowing you to ensure the correct version tag is being published. +5. Now ensure the version tag selected is semantically accurate based on the changes included. +6. Click _"Publish Release"_. + - This will push a new tag and trigger your publishing pipeline on CircleCI. \ No newline at end of file diff --git a/src/@orb.yml b/src/@orb.yml new file mode 100755 index 0000000..d521371 --- /dev/null +++ b/src/@orb.yml @@ -0,0 +1,15 @@ +version: 2.1 + +description: > + Sample orb description +# What will your orb allow users to accomplish? +# Descriptions should be short, simple, and informative. + +# This information will be displayed in the orb registry and is not mandatory. +display: + home_url: "https://www.example.com/docs" + source_url: "https://github.com/qustodio/github-actions-orb" + +# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza. +# orbs: +# hello: circleci/hello-build@0.0.5 diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..b8e1015 --- /dev/null +++ b/src/README.md @@ -0,0 +1,26 @@ +# Orb Source + +Orbs are shipped as individual `orb.yml` files, however, to make development easier, it is possible to author an orb in _unpacked_ form, which can be _packed_ with the CircleCI CLI and published. + +The default `.circleci/config.yml` file contains the configuration code needed to automatically pack, test, and deploy any changes made to the contents of the orb source in this directory. + +## @orb.yml + +This is the entry point for our orb "tree", which becomes our `orb.yml` file later. + +Within the `@orb.yml` we generally specify 4 configuration keys + +**Keys** + +1. **version** + Specify version 2.1 for orb-compatible configuration `version: 2.1` +2. **description** + Give your orb a description. Shown within the CLI and orb registry +3. **display** + Specify the `home_url` referencing documentation or product URL, and `source_url` linking to the orb's source repository. +4. **orbs** + (optional) Some orbs may depend on other orbs. Import them here. + +## See: + - [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) + - [Reusable Configuration](https://circleci.com/docs/2.0/reusing-config) diff --git a/src/commands/greet.yml b/src/commands/greet.yml new file mode 100755 index 0000000..f4e2205 --- /dev/null +++ b/src/commands/greet.yml @@ -0,0 +1,15 @@ +description: > + This command echos "Hello World" using file inclusion. +# What will this command do? +# Descriptions should be short, simple, and clear. +parameters: + to: + type: string + default: "World" + description: "Hello to whom?" +steps: + - run: + environment: + PARAM_TO: <> + name: Hello Greeting + command: <> diff --git a/src/examples/example.yml b/src/examples/example.yml new file mode 100755 index 0000000..a2cdaab --- /dev/null +++ b/src/examples/example.yml @@ -0,0 +1,13 @@ +description: > + Sample example description. +# Provide a use-case based example for using this orb. +# Everything in the `usage` section will be displayed in the orb registry. +# Comments are not retained. +usage: + version: 2.1 + orbs: + : /@1.2.3 + workflows: + use-my-orb: + jobs: + - / diff --git a/src/executors/default.yml b/src/executors/default.yml new file mode 100755 index 0000000..ca3f5dc --- /dev/null +++ b/src/executors/default.yml @@ -0,0 +1,12 @@ +description: > + This is a sample executor using Docker and Node. If you want to provide a custom environment in your orb, insert your image here. + If you do not require an executor, you can simply delete this directory. +docker: + - image: 'cimg/node:<>' +parameters: + tag: + default: lts + description: > + Pick a specific cimg/node image variant: + https://hub.docker.com/r/cimg/node/tags + type: string diff --git a/src/jobs/hello.yml b/src/jobs/hello.yml new file mode 100755 index 0000000..8f1df04 --- /dev/null +++ b/src/jobs/hello.yml @@ -0,0 +1,14 @@ +description: > + Sample description +# What will this job do? + +executor: default + +parameters: + to: + type: string + default: "World" + description: "Hello to whom?" +steps: + - greet: + to: << parameters.to >> diff --git a/src/scripts/greet.sh b/src/scripts/greet.sh new file mode 100644 index 0000000..f01be79 --- /dev/null +++ b/src/scripts/greet.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo Hello "${PARAM_TO}" \ No newline at end of file