-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cd: create new workflows #3 * fix: create setup .NET * feat: create testing workflow * fix: change dotnet version * fix: change on PR & collectCoverage
- Loading branch information
1 parent
63bec7b
commit c210600
Showing
7 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
name: Coverage | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0 | ||
|
||
- name: Install dependencies | ||
run: dotnet add package Microsoft.CodeCoverage | ||
|
||
- name: Test | ||
run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true | ||
|
||
- uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage.cobertura.xml |
This file contains 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,74 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
versioning: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.latest_version.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: latest_version | ||
name: Latest version | ||
run: node version.js >> $GITHUB_OUTPUT | ||
|
||
create-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
needs: | ||
- versioning | ||
outputs: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
steps: | ||
- name: Create Release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.versioning.outputs.version }} | ||
release_name: Release ${{ needs.versioning.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
|
||
build-docker: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
needs: | ||
- versioning | ||
- create-release | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Docker image | ||
run: echo "v${{ needs.versioning.outputs.version }}" | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.version }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains 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,28 @@ | ||
name: Tagging | ||
|
||
on: | ||
push: | ||
branches: ["dev"] | ||
|
||
jobs: | ||
tagging: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup node 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: "npm" | ||
- name: Git Identity | ||
run: | | ||
git checkout dev | ||
git fetch --all --tags | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Antonio Donis" | ||
- name: Changelog | ||
run: 'npx standard-version --message "[ci skip] chore(release): %s"' | ||
- name: Push changes | ||
run: git push --follow-tags --force origin dev |
This file contains 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,26 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: ["dev"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout PR branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0 | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build and Test | ||
run: dotnet test --no-restore --verbosity normal |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,7 @@ | ||
{ | ||
"devDependencies": { | ||
"git-semver-tags": "^4.1.1", | ||
"standard-version": "^9.5.0" | ||
}, | ||
"version": "0.0.0" | ||
} |
This file contains 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,10 @@ | ||
const fs = require("fs"); | ||
|
||
fs.readFile("package.json", "utf8", (err, data) => { | ||
if (err) { | ||
console.error("Failed to read package.json:", err); | ||
process.exit(1); | ||
} | ||
const pkg = JSON.parse(data); | ||
console.log(`version=${pkg.version}`); | ||
}); |