Skip to content

Commit 692c949

Browse files
authored
Updates (#15)
* Fix Password Login * Prevent Hanging on Error * Add Job Summary * Improve Output * Add Test to Cron * Update Workflows
1 parent b82bf8e commit 692c949

File tree

13 files changed

+341
-134
lines changed

13 files changed

+341
-134
lines changed

.github/workflows/lint.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Lint"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
lint:
11+
name: "Lint"
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
15+
steps:
16+
- name: "Checkout"
17+
uses: actions/checkout@v4
18+
19+
#- name: "Debug event.json"
20+
# run: |
21+
# cat "${GITHUB_EVENT_PATH}"
22+
23+
- name: "ShellCheck"
24+
if: ${{ always() }}
25+
uses: ludeeus/action-shellcheck@master
26+
env:
27+
SHELLCHECK_OPTS: -x
28+
with:
29+
scandir: src
30+
31+
- name: "Prettier"
32+
if: ${{ always() }}
33+
run: |
34+
npm install prettier
35+
npx prettier --check .

.github/workflows/mirror.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: "Mirror"
22

33
on:
44
workflow_dispatch:
5-
release:
6-
types: ["published"]
75
push:
86
branches: ["**"]
97
tags: ["**"]
@@ -21,7 +19,7 @@ jobs:
2119
fetch-depth: 0
2220

2321
- name: "Mirror to Codeberg"
24-
uses: cssnr/mirror-repository-action@master
22+
uses: cssnr/mirror-repository-action@v1
2523
with:
2624
host: https://codeberg.org
2725
create: true

.github/workflows/release.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Release"
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
name: "Release"
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: "Update Tags"
17+
uses: cssnr/update-version-tags-action@v1

.github/workflows/tags.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
name: "Tags"
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Target Tag"
8+
required: true
69

710
jobs:
811
tags:
912
name: "Tags"
1013
runs-on: ubuntu-latest
1114
timeout-minutes: 5
15+
permissions:
16+
contents: write
1217

1318
steps:
1419
- name: "Update Tags"
1520
uses: cssnr/update-version-tags-action@v1
1621
with:
17-
token: ${{ secrets.GITHUB_TOKEN }}
22+
tag: ${{ inputs.tag }}
23+
token: ${{ secrets.GH_PAT }}

.github/workflows/test.yaml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,45 @@ name: "Test"
22

33
on:
44
workflow_dispatch:
5-
pull_request:
5+
schedule:
6+
- cron: "23 23 * * 4"
67
push:
7-
branches: [master]
8+
paths:
9+
- "src/**"
10+
- ".github/workflows/test.yaml"
11+
- "Dockerfile"
12+
- "action.yaml"
813

914
env:
1015
PRIVATE_IMAGE: "smashedr/alpine-private:latest" # amd64/arm64
1116

1217
jobs:
1318
test:
1419
name: "Test"
20+
if: ${{ !contains(github.event.head_commit.message, '#notest') }}
1521
runs-on: ubuntu-latest
1622
timeout-minutes: 5
23+
concurrency:
24+
group: test
25+
cancel-in-progress: true
1726

1827
steps:
1928
- name: "Checkout"
2029
uses: actions/checkout@v4
2130

22-
- name: "Write YAML Basic"
31+
#- name: "Debug event.json"
32+
# run: |
33+
# cat "${GITHUB_EVENT_PATH}"
34+
35+
- name: "1: Write YAML"
36+
if: ${{ always() }}
2337
uses: teunmooij/yaml@v1
2438
with:
2539
data: '{"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}'
2640
to-file: "docker-compose.yaml"
2741

28-
- name: "Test Action Basic"
42+
- name: "1: Test Password"
43+
if: ${{ always() }}
2944
id: test1
3045
uses: ./
3146
with:
@@ -34,16 +49,18 @@ jobs:
3449
host: ${{ secrets.DOCKER_HOST }}
3550
port: ${{ secrets.DOCKER_PORT }}
3651
user: ${{ secrets.DOCKER_USER }}
37-
#pass: ${{ secrets.DOCKER_PASS }}
38-
ssh_key: "${{ secrets.DOCKER_SSH_KEY }}"
52+
pass: ${{ secrets.DOCKER_PASS }}
53+
#ssh_key: "${{ secrets.DOCKER_SSH_KEY }}"
3954

40-
- name: "Write YAML Private"
55+
- name: "2: Write YAML"
56+
if: ${{ always() && !github.event.act }}
4157
uses: teunmooij/yaml@v1
4258
with:
4359
data: '{"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}'
4460
to-file: "docker-compose.yaml"
4561

46-
- name: "Test Action Private"
62+
- name: "2: Test SSH and Auth"
63+
if: ${{ always() && !github.event.act }}
4764
id: test2
4865
uses: ./
4966
with:
@@ -54,20 +71,6 @@ jobs:
5471
user: ${{ secrets.DOCKER_USER }}
5572
#pass: ${{ secrets.DOCKER_PASS }}
5673
ssh_key: "${{ secrets.DOCKER_SSH_KEY }}"
57-
#registry_host: "ghcr.io"
5874
registry_user: ${{ vars.DOCKER_HUB_USER }}
5975
registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
60-
61-
lint:
62-
name: "Lint"
63-
runs-on: ubuntu-latest
64-
timeout-minutes: 5
65-
66-
steps:
67-
- name: "Checkout"
68-
uses: actions/checkout@v4
69-
70-
- name: "ShellCheck"
71-
uses: ludeeus/action-shellcheck@master
72-
with:
73-
scandir: src
76+
summary: false

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# IDE
2+
.idea/
3+
.vscode/
4+
5+
# Tools
6+
.ruff_cache/
7+
.mypy_cache/
8+
.pytest_cache/

CONTRIBUTING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Contributing
2+
3+
> [!WARNING]
4+
> This guide is a work in progress and may not be complete.
5+
6+
This is a basic contributing guide and is a work in progress.
7+
8+
## Workflow
9+
10+
1. Fork the repository.
11+
2. Create a branch in your fork!
12+
3. Make your changes.
13+
4. [Test](#Testing) your changes.
14+
5. Commit and push your changes.
15+
6. Create a PR to this repository.
16+
7. Verify the tests pass, otherwise resolve.
17+
8. Make sure to keep your branch up-to-date.
18+
19+
## Testing
20+
21+
GitHub is easier to set up, but you have to push your commits to test.
22+
Running locally is harder to set up, but it is much easier to test; and by far recommended!
23+
24+
### GitHub
25+
26+
Add your secrets to GitHub Actions Secrets.
27+
28+
When you push your branch to your repository, the [test.yaml](.github/workflows/test.yaml) should run...
29+
30+
### Locally
31+
32+
To run actions locally you need to install act: https://nektosact.com/installation/index.html
33+
34+
1. Create a `.secrets` file with all your secrets in .env file format.
35+
2. Run: `act -j test`
36+
37+
To test the private image you must create a `.env` file with, or use --env `PRIVATE_IMAGE=yourimage`
38+
39+
To skip the private image test run with `-e event.json`.
40+
41+
To print your secrets in plan text (insecure) use `--insecure-secrets`
42+
43+
To see all available jobs run `act -l` and see `act --help`
44+
45+
```shell
46+
act -j test --insecure-secrets -e event.json
47+
act -j test --insecure-secrets --env PRIVATE_IMAGE=your/private-image:latest
48+
act -j lint
49+
```
50+
51+
For more information see the documentation: https://nektosact.com/usage/index.html

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM docker:24-dind
1+
FROM docker:28-dind
22

33
RUN apk add --update --no-cache bash sshpass
44

5-
COPY src/main.sh /main.sh
5+
COPY src/ /src
66

7-
ENTRYPOINT ["bash", "/main.sh"]
7+
ENTRYPOINT ["bash", "/src/main.sh"]

0 commit comments

Comments
 (0)