-
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
0 parents
commit f287355
Showing
19 changed files
with
11,075 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,18 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: gomod | ||
directory: / | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: docker | ||
directory: / | ||
schedule: | ||
interval: daily |
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,40 @@ | ||
name: ci-pull-request | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: checkout | ||
name: checkout | ||
uses: actions/checkout@v3 | ||
- id: setup-go | ||
name: setup-go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- id: go-build | ||
name: go-build | ||
run: | | ||
OSS=(linux darwin) | ||
ARCHS=(amd64 arm64) | ||
go get | ||
for OS in "${OSS[@]}"; do | ||
for ARCH in "${ARCHS[@]}"; do | ||
env GOOS="${OS}" GOARCH="${ARCH}" \ | ||
go build -o "./dist/ghapp_${OS}_${ARCH}" | ||
done | ||
done | ||
- id: docker-build | ||
name: docker-build | ||
run: | | ||
docker buildx build . \ | ||
--platform=linux/amd64,linux/arm64 |
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,96 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
version: | ||
name: version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.emit.outputs.version }} | ||
steps: | ||
- id: checkout | ||
name: checkout | ||
uses: actions/checkout@v3 | ||
- id: emit | ||
name: emit | ||
run: | | ||
echo "emitting version..." | ||
[[ ${GITHUB_REF_TYPE} == "branch" ]] && { | ||
LATEST=$(cat .version) | ||
SHA=$(git rev-parse --short "${GITHUB_SHA}") | ||
VERSION="${LATEST}-next-${SHA}" | ||
} | ||
[[ ${GITHUB_REF_TYPE} == "tag" ]] && { | ||
VERSION="${GITHUB_REF_NAME}" | ||
} | ||
echo "emitted version ${VERSION}" | ||
echo "::set-output name=version::${VERSION}" | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
needs: [ version ] | ||
env: | ||
DOCKER_REGISTRY_HOST: docker.io | ||
DOCKER_REGISTRY_PATH: jhagestedt/ghapp | ||
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | ||
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | ||
VERSION: ${{ needs.version.outputs.version }} | ||
steps: | ||
- id: checkout | ||
name: checkout | ||
uses: actions/checkout@v3 | ||
- id: setup-go | ||
name: setup-go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- id: go-build | ||
name: go-build | ||
run: | | ||
OSS=(linux darwin) | ||
ARCHS=(amd64 arm64) | ||
go get | ||
for OS in "${OSS[@]}"; do | ||
for ARCH in "${ARCHS[@]}"; do | ||
env GOOS="${OS}" GOARCH="${ARCH}" \ | ||
go build \ | ||
-o "./dist/ghapp_${OS}_${ARCH}" \ | ||
-ldflags "-X main.version=${VERSION}" | ||
done | ||
done | ||
- id: go-assets | ||
name: go-assets | ||
if: ${{ github.ref_type == 'tag' }} | ||
run: | | ||
for ASSET in ./dist/*; do | ||
gh release upload "${VERSION}" "${ASSET}" | ||
done | ||
- id: docker-login | ||
name: docker-login | ||
run: | | ||
echo "${DOCKER_REGISTRY_PASSWORD}" | \ | ||
docker login "${DOCKER_REGISTRY_HOST}" \ | ||
--username "${DOCKER_REGISTRY_USERNAME}" \ | ||
--password-stdin | ||
- id: docker-build | ||
name: docker-build | ||
run: | | ||
docker buildx build . \ | ||
--push \ | ||
--tag "${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_PATH}:${VERSION}" | ||
- id: docker-build-latest | ||
name: docker-build-latest | ||
if: ${{ github.ref_type == 'tag' }} | ||
run: | | ||
docker buildx build . \ | ||
--push \ | ||
--tag "${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_PATH}:latest" |
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,38 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: [ main ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
GIT_AUTHOR_NAME: ${{ github.actor }} | ||
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
GIT_COMMITTER_NAME: ${{ github.actor }} | ||
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com | ||
|
||
jobs: | ||
release: | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: checkout | ||
name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- id: setup-node | ||
name: setup-node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- id: release | ||
name: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
npm install | ||
npm run release |
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,4 @@ | ||
.idea/ | ||
dist/ | ||
node_modules/ | ||
.github-app-private-key.pem |
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,17 @@ | ||
tagFormat: ${version} | ||
branches: | ||
- main | ||
plugins: | ||
- "@semantic-release/commit-analyzer" | ||
- "@semantic-release/release-notes-generator" | ||
- "@semantic-release/github" | ||
- - "@semantic-release/changelog" | ||
- changelogFile: CHANGELOG.md | ||
- - "@semantic-release/exec" | ||
- prepareCmd: > | ||
echo "${nextRelease.version}" > .version | ||
- - "@semantic-release/git" | ||
- message: "ci(release): ${nextRelease.version}" | ||
assets: | ||
- .version | ||
- CHANGELOG.md |
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 @@ | ||
0.0.1 |
Empty file.
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,6 @@ | ||
FROM scratch AS cli | ||
ARG TARGETOS="linux" | ||
ARG TARGETARCH="amd64" | ||
COPY ./dist/ghapp_${TARGETOS}_${TARGETARCH} /ghapp | ||
ENTRYPOINT ["/ghapp"] | ||
CMD ["help"] |
Oops, something went wrong.