@totallymoney/github-serverless-dotnet-artifacts v4.0.7
github serverless dotnet artifacts
Publish and deploy serverless dotnet projects using github managed artifacts.
Serverless packaging is performed correctly.
Requirements
yarn,gh&dotnetare available on the command lineAmazon.Lambda.Toolsdotnet tool is installed in the target dotnet repo:
$ dotnet new tool-manifest
$ dotnet tool install Amazon.Lambda.ToolsUsage
- Install
$ yarn add -D @totallymoney/github-serverless-dotnet-artifacts- Specify this package location in your
serverless.yml
package:
artifact: package.zip- Add a
publishstep to your CI pipeline to create a github release
$ yarn run gsda-publish $VERSION [ -p path/to/project ]$VERSIONis the github release name in semver format-pis optional with a default value of./src
- Use the
deploycommand to update an enviroment
$ yarn run gsda-deploy $VERSION $ENVIRONMENT$VERSIONis the github release to deploy$ENVIRONMENTis the target environment (aka serverless 'stage')
- Add a helper script to your
package.jsonand usepickfor interactive deployments!
"scripts": {
"pick": "gsda-pick -e stage -e prod -c 5"
}$ yarn pick-e(multiple) are preset environments forpick-cis the version list count forpick- both
-eand-chave sensible defaults and can be overridden whenpickis called
Development
Make sure you belong to the totallymoney npm organization. Then make changes to the source code and publish. Enter the new version number as prompted. A git push command will run automatically after publishing.
$ git commit -am "Improve logging"
$ yarn publish --access publicMigrating from 3.x.x to 4.x.x
github cli is required on your machine.
$ brew install gh # start interactive setup $ gh auth loginThe
deploy&publishnpm scripts are now obselete.Even in 3.x.x, these commands only existed as a level of indirection to centralize input that could be called from more than one place and be burdensome to type. These commands are now less of a burden because the
ghcli automatically recognises the repo it is operating on. We no longer need to "pin" the repo name withdeploy&publishindirection commands, and can instead go straight togsda-deploy|publish. We should, however, favourgsda-pickto manually deploy from the command line overgsda-deploy.gsda-picknow usesgsda-deployinternally, and no longer expectsdeployto exist.The positional arguments of
gsda-deployremain the same: version, then target environment. So ifdeployis called by CI tooling, the only change required is to usegsda-deployinstead.The removal of
publishalso avoids any confusion caused by "squatting" on the existing (npm|yarn)publishcommand.The project path of the
gsda-publishcommand is provided via the optional-pflag.If not specified, the project path defaults to
./srcwhich is the case for most projects. The version argument is still the first positional argument expected bygsda-publish. The command should be called directly from CI tooling, and called directly from the command line if ever needed outside of a CI context.The commit hash positional argument to the
gsda-publishcommand is obselete.Again,
ghunderstands the context and will create a release from the current state of the repo, which will be checked out at the commit we wish to tag.If building with CircleCI the github-cli orb is required.
package.json
"devDependencies": { - "@totallymoney/github-serverless-dotnet-artifacts": "^3.2.0", + "@totallymoney/github-serverless-dotnet-artifacts": "^4.0.0", }, "scripts": { - "publish": "gsda-publish org/repo proj/path", - "deploy": "gsda-deploy org/repo", }.github/workflows/build.yml
- if: github.ref == 'refs/heads/main' - run: yarn run publish $VERSION $GITHUB_SHA + run: yarn run gsda-publish $VERSION -p proj/path env: - GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION: 0.0.${{ github.run_number }}.circleci/config.yml
+ orbs: + github-cli: circleci/github-cli@2.3.0 - when: condition: equal: [ << pipeline.git.branch >>, main ] steps: + - github-cli/setup: + token: GITHUB_OAUTH_TOKEN - run: - command: yarn run publish $VERSION $CIRCLE_SHA1 + command: yarn run gsda-publish $VERSION -p proj/path environment: VERSION: 0.0.<< pipeline.number >>
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago