Skip to content

Added ability to reprocess from a specific timestamp #450

Added ability to reprocess from a specific timestamp

Added ability to reprocess from a specific timestamp #450

Workflow file for this run

name: Contracts CI/CD
env:
PRERELEASE_BRANCHES: elrond,boromir
on:
push:
branches:
- "**"
pull_request:
types: [closed]
jobs:
context:
name: Setup context for release
runs-on: ubuntu-latest
outputs:
should-publish: ${{ steps.context.outputs.should-publish }}
pr-body: ${{ steps.context.outputs.pr-body }}
pr-url: ${{ steps.context.outputs.pr-url }}
version: ${{ steps.increment-version.outputs.next-version }}
versioninfo-version: ${{ steps.increment-version.outputs.next-version || '0.0.0-norelease' }}
release-type: ${{ steps.context.outputs.release-type }}
steps:
- uses: actions/checkout@v2
- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
dot-net-build:
name: .Net Build
runs-on: ubuntu-latest
needs: context
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/CSharp/VersionInfo.cs
- run: dotnet build -c Release
working-directory: ./Generation/CSharp
java-script-build:
name: JavaScript Build
runs-on: ubuntu-latest
needs: context
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: ./Generation/JavaScript
run: yarn
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/JavaScript/VersionInfo.js
- name: Build Contracts
working-directory: ./Generation/JavaScript
run: yarn build
java-script-web-build:
name: JavaScript.Web Build
runs-on: ubuntu-latest
needs: context
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: ./Generation/JavaScript.Web
run: yarn
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/JavaScript.Web/VersionInfo.js
- name: Build Contracts
working-directory: ./Generation/JavaScript.Web
run: yarn build
# golang-build:
# name: Go Build
# runs-on: ubuntu-latest
# needs: context
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2
# with:
# go-version: "1.16.2"
# - uses: arduino/setup-protoc@v1
# with:
# version: "3.18.1"
# - run: go get google.golang.org/protobuf/cmd/protoc-gen-go google.golang.org/grpc/cmd/protoc-gen-go-grpc
# - name: Update VersionInfo
# uses: dolittle/update-version-info-action@v1
# with:
# version: ${{ needs.context.outputs.versioninfo-version }}
# files-to-update: |
# Generation/Go/template/VersionInfo.go
# - name: Generate code
# working-directory: ./Generation/Go
# run: ./generate.sh ${{ needs.context.outputs.version }}
release:
name: Release
runs-on: ubuntu-latest
needs: [context, dot-net-build, java-script-build, java-script-web-build]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Prepend to Changelog
if: ${{ needs.context.outputs.should-publish == 'true' && needs.context.outputs.release-type != 'prerelease' }}
uses: dolittle/add-to-changelog-action@v2
with:
version: ${{ needs.context.outputs.version }}
body: ${{ needs.context.outputs.pr-body }}
pr-url: ${{ needs.context.outputs.pr-url }}
changelog-path: CHANGELOG.md
user-email: build@dolittle.com
user-name: dolittle-build
- name: Create GitHub Release
uses: dolittle/github-release-action@v2
with:
version: ${{ needs.context.outputs.version }}
body: ${{ needs.context.outputs.pr-body }}
dot-net-release:
name: .Net Release
runs-on: ubuntu-latest
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/CSharp/VersionInfo.cs
- run: dotnet build
working-directory: ./Generation/CSharp
- name: Create packages
working-directory: ./Generation/CSharp
run: dotnet pack --configuration Release -o Artifacts/NuGet /p:PackageVersion=${{ needs.context.outputs.version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:NoDefaultExcludes=true
- name: Push NuGet packages
working-directory: ./Generation/CSharp
run: dotnet nuget push 'Artifacts/NuGet/*.nupkg' --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
java-script-release:
name: JavaScript Release
runs-on: ubuntu-latest
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: ./Generation/JavaScript
run: yarn
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/JavaScript/VersionInfo.js
- name: Build Contracts
working-directory: ./Generation/JavaScript
run: yarn build
- name: Update Contracts version
working-directory: ./Generation/JavaScript
run: npm version ${{ needs.context.outputs.version }}
- name: Extract tag from version
uses: actions-ecosystem/action-regex-match@v2
id: tag_regex
with:
text: ${{ needs.context.outputs.version }}
regex: '^\d+\.\d+.\d+-([^.]+)\.\d+$'
- name: Publish Contracts
working-directory: ./Generation/JavaScript
run: npm publish --tag ${{ needs.context.outputs.release-type == 'prerelease' && steps.tag_regex.outputs.group1 || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
java-script-web-release:
name: JavaScript.Web Release
runs-on: ubuntu-latest
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: ./Generation/JavaScript.Web
run: yarn
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/JavaScript.Web/VersionInfo.js
- name: Build Contracts
working-directory: ./Generation/JavaScript.Web
run: yarn build
- name: Update Contracts version
working-directory: ./Generation/JavaScript.Web
run: npm version ${{ needs.context.outputs.version }}
- name: Extract tag from version
uses: actions-ecosystem/action-regex-match@v2
id: tag_regex
with:
text: ${{ needs.context.outputs.version }}
regex: '^\d+\.\d+.\d+-([^.]+)\.\d+$'
- name: Publish Contracts
working-directory: ./Generation/JavaScript.Web
run: npm publish --tag ${{ needs.context.outputs.release-type == 'prerelease' && steps.tag_regex.outputs.group1 || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# golang-release:
# name: Go Release
# runs-on: ubuntu-latest
# needs: [context, release]
# if: ${{ needs.context.outputs.should-publish == 'true' }}
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2
# with:
# go-version: "1.16.2"
# - uses: arduino/setup-protoc@v1
# with:
# version: "3.18.1"
# - run: go get google.golang.org/protobuf/cmd/protoc-gen-go google.golang.org/grpc/cmd/protoc-gen-go-grpc
# - name: Update VersionInfo
# uses: dolittle/update-version-info-action@v1
# with:
# version: ${{ needs.context.outputs.versioninfo-version }}
# files-to-update: |
# Generation/Go/template/VersionInfo.go
# - name: Generate code
# working-directory: ./Generation/Go
# run: ./generate.sh ${{ needs.context.outputs.version }}
# - uses: actions/checkout@v2
# with:
# repository: dolittle/Go.Contracts
# token: ${{ secrets.BUILD_PAT }}
# path: ./Generation/Go/output
# - name: Cleanout old released code
# working-directory: ./Generation/Go/output
# run: rm -r * && git checkout -- README.md LICENSE
# - name: Copy new generated code
# working-directory: ./Generation/Go/
# run: cp -r generated/* output
# - name: Commit new generated code and tag as release
# working-directory: ./Generation/Go/output
# run: |
# git config user.name "Contracts Release GitHub Actions"
# git config user.email "contracts-release@dolittle.com"
# git add .
# git commit --allow-empty -m "Generated code for ${{ needs.context.outputs.version }}"
# git tag "v${{ needs.context.outputs.version }}"
# git push
# git push --tags