Add automated releases with binaries and simplify CI workflow
- Add GoReleaser configuration for Linux binaries (amd64, arm64) - Add release job to GitHub Actions for tagged versions - Remove github.server_url validations (Gitea CI disabled) - Update README with binary download instructions - Releases will include compiled binaries and changelogs
This commit is contained in:
@@ -11,7 +11,6 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.server_url == 'https://github.com'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -35,7 +34,6 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.server_url == 'https://github.com'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -55,11 +53,38 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [test, lint]
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.21'
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v5
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: latest
|
||||||
|
args: release --clean
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build and Push Docker Image
|
name: Build and Push Docker Image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test, lint]
|
needs: [test, lint]
|
||||||
if: github.event_name == 'push' && github.server_url == 'https://github.com'
|
if: github.event_name == 'push'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- id: apocapoc-api
|
||||||
|
main: ./cmd/api
|
||||||
|
binary: apocapoc-api
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=1
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
ldflags:
|
||||||
|
- -s -w
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- id: apocapoc-api
|
||||||
|
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||||
|
format: tar.gz
|
||||||
|
files:
|
||||||
|
- README.md
|
||||||
|
- LICENSE
|
||||||
|
|
||||||
|
checksum:
|
||||||
|
name_template: 'checksums.txt'
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- '^docs:'
|
||||||
|
- '^test:'
|
||||||
|
- '^ci:'
|
||||||
|
- Merge pull request
|
||||||
|
- Merge branch
|
||||||
|
|
||||||
|
release:
|
||||||
|
github:
|
||||||
|
owner: davidfolch
|
||||||
|
name: apocapoc-api
|
||||||
|
draft: false
|
||||||
|
prerelease: auto
|
||||||
|
name_template: "{{.Tag}}"
|
||||||
@@ -65,12 +65,21 @@ The API will be available at `http://localhost:8080`
|
|||||||
|
|
||||||
### Using the binary
|
### Using the binary
|
||||||
|
|
||||||
1. Download the latest release
|
1. Download the latest release from [GitHub Releases](https://github.com/davidfolch/apocapoc-api/releases)
|
||||||
2. Copy `.env.example` to `.env` and configure
|
2. Extract the archive:
|
||||||
3. Run: `./apocapoc-api`
|
```bash
|
||||||
|
tar -xzf apocapoc-api_*_linux_amd64.tar.gz
|
||||||
|
```
|
||||||
|
3. Copy `.env.example` to `.env` and configure
|
||||||
|
4. Run the binary:
|
||||||
|
```bash
|
||||||
|
./apocapoc-api
|
||||||
|
```
|
||||||
|
|
||||||
The API will be available at `http://localhost:8080`
|
The API will be available at `http://localhost:8080`
|
||||||
|
|
||||||
|
**Note:** Linux binaries only (amd64 and arm64). For other platforms, use Docker.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|||||||
Reference in New Issue
Block a user