This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
90111b3
commit 7a8e8f9
Showing
8 changed files
with
173 additions
and
13 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,93 @@ | ||
name: Go | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
goosarch: | ||
- 'darwin/amd64' | ||
- 'darwin/arm64' | ||
- 'linux/amd64' | ||
- 'linux/arm64' | ||
- 'windows/amd64' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ariga/setup-atlas@v0 | ||
- uses: sqlc-dev/setup-sqlc@v4 | ||
with: | ||
sqlc-version: '1.26.0' | ||
|
||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
go get . | ||
- name: Get OS and arch info | ||
run: | | ||
GOOSARCH=${{matrix.goosarch}} | ||
GOOS=${GOOSARCH%/*} | ||
GOARCH=${GOOSARCH#*/} | ||
GOEXT=$(if [ "$GOOS" = "windows" ]; then echo ".exe"; else echo ""; fi) | ||
REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} | ||
BINARY_NAME=$REPOSITORY_NAME-$GOOS-$GOARCH$GOEXT | ||
ARTIFACT_NAME=$REPOSITORY_NAME-$GOOS-$GOARCH-$GITHUB_SHA | ||
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV | ||
echo "GOOS=$GOOS" >> $GITHUB_ENV | ||
echo "GOARCH=$GOARCH" >> $GITHUB_ENV | ||
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV | ||
- name: Build SQL | ||
run: | | ||
sqlc generate | ||
- name: Build | ||
run: | | ||
go build -o "dist/$BINARY_NAME" -v | ||
- name: Prepare SQLite database | ||
run: ./update_db.sh dist/server.db | ||
|
||
- name: Prepare dist folder | ||
run: | | ||
cp config.yml dist | ||
cp LICENSE dist | ||
cp -r updates dist | ||
echo $ARTIFACT_NAME | ||
- name: Archive release artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: dist | ||
|
||
release: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download run artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/artifacts | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: release-${{ github.sha }} | ||
generate_release_notes: true | ||
fail_on_unmatched_files: true | ||
files: /tmp/artifacts/* |
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 |
---|---|---|
|
@@ -65,3 +65,4 @@ output | |
|
||
temp_schema_main.sql | ||
temp.db | ||
distextra |
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
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,12 @@ | ||
package constants | ||
|
||
type CardStatus int | ||
|
||
const ( | ||
CardStatusError CardStatus = iota | ||
CardStatusNew | ||
CardStatusSuccess | ||
CardStatusExpired | ||
CardStatusMaintenance | ||
CardStatusEndOfLife | ||
) |