diff --git a/.github/workflows/explorer-deploy.yml b/.github/workflows/deploy.yml similarity index 65% rename from .github/workflows/explorer-deploy.yml rename to .github/workflows/deploy.yml index 968866b..4878fbd 100644 --- a/.github/workflows/explorer-deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,14 @@ -name: ๐Ÿš€ Deploy did explorer +name: Deploy + on: + workflow_run: + workflows: + - Release + types: [completed] + branches: + - main + - release/** + push: branches: - main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..72e09a1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + workflow_run: + workflows: + - Tests + types: [completed] + branches: + - main + - release/** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + semantic-release: + name: ๐Ÿค– Semantic release + runs-on: ubuntu-latest + if: "!contains(github.event.pull_request.labels.*.name, 'skip-release')" + # if: ${{ github.ref_name == 'main' && github.event_name == 'push' }} + outputs: + release: ${{ steps.tag_release.outputs.release }} + version: ${{ steps.tag_release.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.x + - name: Install semantic-release + run: | + npm i npx + npm i semantic-release/changelog + - name: Tag release + id: tag_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npx semantic-release | tee semantic-release.log + if [[ `git tag --points-at HEAD` == "" ]]; then + echo "release=False" >> $GITHUB_OUTPUT + else + echo "release=True" >> $GITHUB_OUTPUT + awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT + fi + + package-release: + name: ๐Ÿ“ฆ release archives + needs: [semantic-release] + if: ${{ needs.semantic-release.outputs.release == 'True' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ needs.semantic-release.outputs.version }} + draft: true + prerelease: false + generate_release_notes: true diff --git a/.github/workflows/index.yml b/.github/workflows/tests.yml similarity index 81% rename from .github/workflows/index.yml rename to .github/workflows/tests.yml index 7931341..de17bc5 100644 --- a/.github/workflows/index.yml +++ b/.github/workflows/tests.yml @@ -1,14 +1,25 @@ -name: W3C-DID +name: Tests + on: push: - branches: [ main ] + paths-ignore: + - 'docs/**' + - '*.md' + branches: + - main + - release/** pull_request: - branches: [ main ] + paths-ignore: + - 'docs/**' + - '*.md' + branches: + - main + - release/** jobs: test-units: runs-on: ubuntu-latest - name: ๐Ÿงช test-units + name: ๐Ÿงช Contract unit tests steps: - name: ๐Ÿ›Ž๏ธ Checkout uses: actions/checkout@v3 @@ -25,7 +36,7 @@ jobs: restroom_job: runs-on: ubuntu-latest - name: ๐Ÿ”ฌ restroom tests + name: ๐Ÿ”ฌ API integration tests steps: - name: ๐Ÿ›Ž๏ธ Checkout uses: actions/checkout@v3 diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..3ab140f --- /dev/null +++ b/.releaserc @@ -0,0 +1,10 @@ +{ + "repositoryUrl": "git@github.com:dyne/W3C-DID.git", + "dryRun": false, + "plugins": [ + "@semantic-release/changelog", + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator" + ], + "branches": [ main ] +}