2023-09-15 23:56:30 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-09-24 18:57:11 +00:00
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
2023-09-15 23:56:30 +00:00
|
|
|
jobs:
|
2023-09-25 01:03:09 +00:00
|
|
|
test-backend:
|
2023-09-15 23:56:30 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: 1.21.1
|
|
|
|
- run: cd backend && go test -race -v ./...
|
2023-09-25 01:03:09 +00:00
|
|
|
lint-backend:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: 1.21.1
|
|
|
|
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
|
|
|
|
- run: cd backend && golangci-lint run
|
|
|
|
format-backend:
|
2023-09-15 23:56:30 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: 1.21.1
|
|
|
|
- run: cd backend && go fmt ./...
|
2023-09-25 01:03:09 +00:00
|
|
|
lint-frontend:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '20'
|
|
|
|
- run: cd frontend && npm i eslint
|
|
|
|
- run: cd frontend && npm run lint
|
2023-09-15 23:56:30 +00:00
|
|
|
push_release_to_registry:
|
2023-09-25 01:03:09 +00:00
|
|
|
needs: [lint-frontend, lint-backend, test-backend, format-backend]
|
2023-09-15 23:56:30 +00:00
|
|
|
name: Push release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3.0.0
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
|
|
# Workaround to fix error:
|
|
|
|
# failed to push: failed to copy: io: read/write on closed pipe
|
|
|
|
# See https://github.com/docker/build-push-action/issues/761
|
|
|
|
with:
|
|
|
|
driver-opts: |
|
|
|
|
image=moby/buildkit:v0.10.6
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
# Only push to Docker Hub when making a release
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
|
|
with:
|
|
|
|
images: gtstef/filebrowser
|
2023-10-10 13:25:14 +00:00
|
|
|
- name: Modify DOCKER_METADATA_OUTPUT_JSON
|
|
|
|
id: modify-json
|
2023-10-10 13:09:59 +00:00
|
|
|
run: |
|
2023-10-10 13:25:14 +00:00
|
|
|
JSON="${{ steps.meta.outputs.DOCKER_METADATA_OUTPUT_JSON }}"
|
|
|
|
# Use jq to remove 'v' from the version field
|
|
|
|
JSON=$(echo "$JSON" | jq '(.tags) |= sub("filebrowser:v"; "filebrowser:")')
|
|
|
|
echo "::set-output name=modified_json::$JSON"
|
2023-09-15 23:56:30 +00:00
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
file: ./Dockerfile
|
|
|
|
push: true
|
2023-10-10 13:31:36 +00:00
|
|
|
tags: ${{ steps.modify-json.outputs.modified_json }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|