Skip to content

Commit

Permalink
feat: add build and publish in registry in relaese job (#7)
Browse files Browse the repository at this point in the history
* feat: add build and publish in registry in relaese job

* feat: add default inputs values for booleans

* feat: remove workflow_dispatch added for testing
  • Loading branch information
dcristaldo authored Apr 17, 2024
1 parent 1aab272 commit 799db89
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:

permissions:
contents: write
packages: write

jobs:
bump_version:
Expand All @@ -21,14 +22,14 @@ jobs:
version: ${{ steps.cz.outputs.version }}
steps:
- name: Check out
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.ACCESS_TOKEN }}"
ref: "main"

- name: Set up Python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.1.0
with:
python-version: 3.11

Expand Down Expand Up @@ -57,3 +58,16 @@ jobs:

- name: Print Version
run: echo "Bumped to version ${{ steps.cz.outputs.version }}"

build:
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
- name: Set up 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: Build and push
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t $(echo "ghcr.io/${{ github.repository }}:latest" | tr '[:upper:]' '[:lower:]') --push .
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
FROM node:18
FROM node:20

LABEL "com.github.actions.icon"="blue"
LABEL "com.github.actions.color"="database"
LABEL "com.github.actions.name"="Sync AWS Secrets Manager"
LABEL "com.github.actions.description"="Sync AWS Secrets Manager with a JSON file"
LABEL "org.opencontainers.image.source"="https://github.com/Drafteame/sync-secrets-manager"

COPY . /app
WORKDIR /app
Expand Down
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const getAction = () => {

const run = async () => {
try {
setDefault("dry_run", "false");
setDefault("show_values", "false");
setDefault("create_secret", "false");

const dryRun = core.getBooleanInput("dry_run");

const changeSet = await getAction().run();
Expand All @@ -33,4 +37,12 @@ const run = async () => {
}
};

const setDefault = (name, value) => {
const envVarName = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
const val = process.env[envVarName] || '';
if (val === '') {
process.env[envVarName] = value;
}
}

run();

0 comments on commit 799db89

Please sign in to comment.