-
Notifications
You must be signed in to change notification settings - Fork 1
feat: release workflow #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
aaabd49
feat: release workflow
Blindspot22 51c768a
Merge remote-tracking branch 'origin' into 340-release-update
Blindspot22 3296ab3
fix: update changes from review
Blindspot22 aae4d07
fix: added cron_script, add a check to ensure changes before release
Blindspot22 076aa8a
feat: adjusted functional release workflow
Blindspot22 0d6cdf2
feat: adjusted functional release workflow
Blindspot22 6644d1d
fix: switch action to maintained version
Blindspot22 f63283a
fix: switch action to maintained version
Blindspot22 6e4aeb7
branch switch
Blindspot22 220e3ae
fix: nix downgrade
Blindspot22 cd538b6
fix: nix update
Blindspot22 008768c
fix: nix update
Blindspot22 40e1eb5
fix: removed windows for pipeline success as it's not required for now
Blindspot22 4656c4d
new fixes
Blindspot22 34a286b
new fixes
Blindspot22 597a464
new fixes
Blindspot22 74660aa
fix: removed windows test for pipeline success as it's not required f…
Blindspot22 f99ab9f
fix: adjust tag and versioning
Blindspot22 b1a9f13
fix: adjust tag and versioning
Blindspot22 ce38748
feat: new update in version
Blindspot22 faf67d4
Merge remote-tracking branch 'origin' into 340-release-update
Blindspot22 023b64c
fix: resolving conflicts
Blindspot22 febce4d
feat: final adjustment and test
Blindspot22 c40e83e
fix: overindentation
Blindspot22 0e66574
fix: over indentation
Blindspot22 84b4994
Merge remote-tracking branch 'origin' into 340-release-update
Blindspot22 3cd0161
fix: over indentation
Blindspot22 afd1444
Update actions/upload-artifact to v4
Blindspot22 297bcd2
fix: unused imports
Blindspot22 8dba6cd
fix: unused imports
Blindspot22 dd9d121
fix: code format
Blindspot22 1362ded
removed unused import mongodb
Blindspot22 31e648c
adjust binary path
Blindspot22 955f4f0
adjust binary path
Blindspot22 2023935
Adding write permissions
Blindspot22 c1e66f2
feat: changes from review
Blindspot22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Check if the current week is divisible by 3 | ||
| if (( $(date +%U) % 3 == 0 )); then | ||
| # Your actual task here | ||
| echo "Running the job as it's the 3rd week." | ||
| else | ||
| echo "Skipping this week." | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| name: Release Workflow | ||
|
|
||
| on: | ||
| schedule: | ||
| # Runs every Monday at 12:00 UTC | ||
| - cron: "0 12 * * 1" | ||
|
|
||
| workflow_dispatch: # Allows manual triggering of the workflow | ||
| inputs: | ||
| release_notes: | ||
| description: 'This is the initial release of didcomm-mediator-rs, a Rust implementation of a mediator for the DIDComm v2 protocol. The mediator facilitates secure, decentralized communication by managing routing of DIDComm messages for mobile agents in a Self-Sovereign Identity (SSI) ecosystem.' | ||
| required: true | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Create Release | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: Set up Rust | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| override: true | ||
|
|
||
| - name: Check for Changes | ||
| id: check_changes | ||
| run: | | ||
| # Fetch tags to compare with the latest release | ||
| git fetch --tags | ||
|
|
||
| # Get the latest tag and compare it with the current branch | ||
| latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
Blindspot22 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| echo "Latest tag: $latest_tag" | ||
|
|
||
| # Check for differences | ||
| if [ -z "$latest_tag" ] || [ "$(git diff $latest_tag --stat)" != "" ]; then | ||
| echo "Changes detected since the last release." | ||
| echo "proceed=true" >> $GITHUB_ENV | ||
| else | ||
| echo "No changes detected since the last release." | ||
| echo "proceed=false" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Exit if No Changes | ||
| if: env.proceed == 'false' | ||
| run: | | ||
| echo "No changes to release. Exiting..." | ||
| exit 0 | ||
|
|
||
| - name: Build the project | ||
| run: cargo build --release | ||
|
|
||
| - name: Run Cron Script | ||
| run: | | ||
| set -e # Exit on any error | ||
| chmod +x ./scripts/cron_script.sh | ||
| ./scripts/cron_script.sh | ||
Blindspot22 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Bump Version | ||
| id: version | ||
| run: | | ||
| version=$(cargo pkgid | grep -oP '(?<=#).*') # Extract current version | ||
| new_version=$(echo $version | awk -F. '{$NF+=1; print $0}' OFS=.) # Increment patch | ||
| echo "new_version=$new_version" >> $GITHUB_ENV | ||
|
|
||
| - name: Configure Git | ||
| run: | | ||
| git config --global user.email "github-actions@users.noreply.github.com" | ||
| git config --global user.name "github-actions" | ||
|
|
||
| - name: Create Release Branch and Commit Changes | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| script: | | ||
| const newVersion = process.env.new_version; | ||
| const exec = require("@actions/exec"); | ||
|
|
||
| // Create a new branch | ||
| await exec.exec("git", ["checkout", "-b", `release/${newVersion}`]); | ||
|
|
||
| // Update version in Cargo.toml | ||
| const fs = require("fs"); | ||
| const cargoToml = fs.readFileSync("Cargo.toml", "utf-8"); | ||
| const updatedCargoToml = cargoToml.replace(/version = ".*"/, `version = "${newVersion}"`); | ||
| fs.writeFileSync("Cargo.toml", updatedCargoToml); | ||
|
|
||
| // Commit and push changes | ||
| await exec.exec("git", ["commit", "-am", `Release ${newVersion}`]); | ||
| await exec.exec("git", ["push", "origin", `release/${newVersion}`]); | ||
Blindspot22 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Create GitHub Release | ||
| uses: actions/create-release@v1 | ||
| with: | ||
| tag_name: "v${{ env.new_version }}" | ||
| release_name: "Release ${{ env.new_version }}" | ||
| body: ${{ github.event.inputs.release_notes || 'Scheduled Release' }} | ||
| draft: false | ||
| prerelease: false | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.