-
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.
- Loading branch information
Showing
11 changed files
with
111 additions
and
85 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
|
@@ -22,33 +22,33 @@ jobs: | |
version: ${{ steps.cz.outputs.version }} | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@v4.1.5 | ||
with: | ||
fetch-depth: 0 | ||
token: "${{ secrets.ACCESS_TOKEN }}" | ||
ref: "main" | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Config Git User | ||
run: | | ||
git config --local user.email "$GIT_USER_EMAIL" | ||
git config --local user.name "$GIT_USER_NAME" | ||
git config --local pull.ff only | ||
- id: cz | ||
name: Create bump and changelog | ||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Create bump and changelog | ||
id: cz | ||
run: | | ||
python -m pip install -U commitizen | ||
cz bump --yes | ||
export REV=`cz version --project` | ||
echo "version=\"v$REV\"" >> $GITHUB_OUTPUT | ||
- name: Push changes | ||
uses: ad-m/github-push-action@v0.6.0 | ||
uses: ad-m/github-push-action@v0.8.0 | ||
with: | ||
github_token: ${{ secrets.ACCESS_TOKEN }} | ||
repository: "Drafteame/sync-secrets-manager" | ||
|
@@ -61,13 +61,29 @@ jobs: | |
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- bump_version | ||
steps: | ||
- name: 🛎 Checkout | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up buildx | ||
|
||
- name: Setup buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to ghcr.io | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Log in to GitHub container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
logout: false | ||
|
||
- name: Set repo name | ||
run: | | ||
repo=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | ||
echo "REPO=$repo" >> $GITHUB_ENV | ||
- name: Build and push | ||
run: | | ||
docker buildx build --platform linux/amd64,linux/arm64 -t $(echo "ghcr.io/${{ github.repository }}:latest" | tr '[:upper:]' '[:lower:]') --push . | ||
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.REPO }}:latest --push . | ||
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.REPO }}:${{ needs.bump_version.outputs.version }} --push . |
File renamed without changes.
This file was deleted.
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
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
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
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
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
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,64 @@ | ||
import core from "@actions/core"; | ||
|
||
/** | ||
* Checks if a given value is empty. | ||
* | ||
* @param {*} value - The value to check for emptiness. | ||
* @returns {boolean} - Returns true if the value is empty, false otherwise. | ||
*/ | ||
export function isEmpty(value) { | ||
if (value == null || value == undefined) { | ||
// Handles null and undefined | ||
return true; | ||
} | ||
|
||
if (typeof value === "boolean") { | ||
// Boolean values are never empty | ||
return false; | ||
} | ||
|
||
if (typeof value === "number") { | ||
// Number values are never empty | ||
return false; | ||
} | ||
|
||
if (typeof value === "string") { | ||
// Check if the string is empty | ||
return value.trim().length === 0; | ||
} | ||
|
||
// For any other types, assume it's not empty | ||
return false; | ||
} | ||
|
||
/** | ||
* Get action input with default value | ||
* @param {string} input input name to retrieve | ||
* @param {string} value string default value | ||
* @returns {string} The value of input, if is empty it return the default one | ||
*/ | ||
export function getInput(input, value = "") { | ||
const inputValue = core.getInput(input); | ||
|
||
if (isEmpty(inputValue)) { | ||
return value; | ||
} | ||
|
||
return inputValue; | ||
} | ||
|
||
/** | ||
* Get action boolean input | ||
* @param {string} input input name to retrieve | ||
* @param {boolean} value boolean default value | ||
* @returns {boolean} The value of the input, if it is empty ir return the default one | ||
*/ | ||
export function getBooleanInput(input, value = false) { | ||
const inputValue = core.getInput(input); | ||
|
||
if (isEmpty(inputValue)) { | ||
return value; | ||
} | ||
|
||
return inputValue.trim().toLowerCase() === "true"; | ||
} |