Skip to content

Commit

Permalink
Initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Feb 29, 2024
1 parent d549eca commit 8dc82ea
Show file tree
Hide file tree
Showing 16 changed files with 585 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Global
* @ffried

# Workflow & Deployment related files
.github/* @ffried
action.yml @ffried

# Project & Source files
/*.json @ffried
*.ts @ffried
17 changes: 17 additions & 0 deletions .github/actions/generate-action-code/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Generate Action Code
description: Generates the action code

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: npm
- name: Generate action code
shell: bash
run: |
npm clean-install
npm run build
npm run pack
4 changes: 4 additions & 0 deletions .github/codeql/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
paths-ignore:
- node_modules
- dist
- lib
38 changes: 38 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: /
open-pull-requests-limit: 10
schedule:
interval: daily
time: '07:00'
timezone: Europe/Berlin
assignees:
- ffried
reviewers:
- ffried

- package-ecosystem: github-actions
directory: .github/actions/generate-action-code
open-pull-requests-limit: 10
schedule:
interval: daily
time: '07:00'
timezone: Europe/Berlin
assignees:
- ffried
reviewers:
- ffried

- package-ecosystem: npm
directory: /
open-pull-requests-limit: 10
schedule:
interval: daily
time: '07:00'
timezone: Europe/Berlin
assignees:
- ffried
reviewers:
- ffried
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CodeQL

on:
push:
branches: [ main ]
paths-ignore: [ 'dist/*.js' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '15 11 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/config.yml
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
29 changes: 29 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Action Code

on:
push:
branches: [ main ]
paths-ignore: [ 'dist/*.js' ]

jobs:
deploy-action-code:
name: Deploy Action Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_TOKEN }}
- uses: ./.github/actions/generate-action-code
- name: Configure repository
env:
BOT_USERNAME: ${{ secrets.BOT_USERNAME }}
run: |
git config user.name "${BOT_USERNAME}"
git config user.email "${BOT_USERNAME}@users.noreply.github.com"
- name: Commit changes
run: |
if ! git diff --exit-code --quiet; then
git add .
git commit -m '[AUTO] Update generated code'
git push
fi
18 changes: 18 additions & 0 deletions .github/workflows/enable-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Auto-merge for Dependabot PRs

on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
enable-auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge
run: gh pr merge --auto --rebase "${PR_URL}"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/tag-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Update Release Tags

on:
release:
types: [ published ]

jobs:
update-tags:
if: ${{ !github.event.release.prerelease }}
name: Update Running Releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sersoft-gmbh/running-release-tags-action@v3
with:
update-full-release: true
github-token: ${{ secrets.GITHUB_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests

on:
push:
branches: [ main ]
paths:
- 'dist/*.js'
- '.github/workflows/tests.yml'
pull_request:
branches: [ main ]

jobs:
test-gh-registry:
name: Test GitHub Registry
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/dotnet-nuget-login-action@main
if: ${{ github.event_name == 'push' }}
id: main-action
with:
registry-url: 'https://nuget.pkg.github.com'
registry-name: 'github'
username: ${{ secrets.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: local-action
with:
registry-url: 'https://nuget.pkg.github.com'
registry-name: 'github'
username: ${{ secrets.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store

.idea/

node_modules/

# Lib is just temporary - so we ignore it
lib/
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
# dotnet-nuget-login-action
A GitHub Action that logs into a Nuget server
# Dotnet Nuget Login Action

[![Tests](https://github.com/sersoft-gmbh/dotnet-nuget-login-action/actions/workflows/tests.yml/badge.svg)](https://github.com/sersoft-gmbh/dotnet-nuget-login-action/actions/workflows/tests.yml)

A GitHub action that logs into a NuGet registry.

## Inputs

### `registry-url`

The URL of the NuGet registry to log in to.

### `registry-name`

The name to use for the registry.
Equivalent to the `--name` parameter of the `nuget sources add` command.

### `username`

The username to use for the login. Use a secret to avoid exposing it in the logs.
Equivalent to the `--username` parameter of the `nuget sources add` command.

### `password`

The password to use for the login. Use a secret to avoid exposing it in the logs.
Equivalent to the `--password` parameter of the `nuget sources add` command.

### `store-password-in-cleartext`

Whether to store the password in cleartext. The cleanup of this action will remove it again.
Equivalent to the `--store-password-in-clear-text` parameter of the `nuget sources add` command.

### `config-file`

The path to the NuGet configuration file. Uses the default config file by default.
Equivalent to the `--configfile` parameter of the `nuget sources add` command.


## Example Usage

```yaml
uses: sersoft-gmbh/dotnet-nuget-login-action@v1
with:
registry-url: 'https://nuget.example.com/v3/index.json'
registry-name: example
username: ${{ secrets.NUGET_USERNAME }}
password: ${{ secrets.NUGET_PASSWORD }}
```
30 changes: 30 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Dotnet Nuget Login
description: Login to a NuGet registry.
author: ser.soft GmbH
inputs:
registry-url:
description: The NuGet registry to log in to.
required: true
registry-name:
description: The name of the registry to log in to.
required: true
username:
description: The username to use for the login.
required: false
password:
description: The password to use for the login.
required: false
store-password-in-cleartext:
description: Whether to store the password in cleartext. The cleanup of this action will remove it again.
required: false
default: 'true'
config-file:
description: The path to the NuGet configuration file. Uses the default config file by default.
required: false
runs:
using: node20
main: dist/index.js
post: dist/post.js
branding:
color: blue
icon: log-in
Loading

0 comments on commit 8dc82ea

Please sign in to comment.