filebrowser/.github/workflows/release.yaml

85 lines
2.7 KiB
YAML
Raw Normal View History

name: release
on:
push:
branches:
2023-09-24 18:57:11 +00:00
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
2023-09-25 01:03:09 +00:00
test-backend:
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:
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
push_release_to_registry:
2023-09-25 01:03:09 +00:00
needs: [lint-frontend, lint-backend, test-backend, format-backend]
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:09:59 +00:00
- name: Remove leading 'v' from tags
id: remove-v
run: |
TAGS="${{ steps.meta.outputs.tags }}"
# Remove the 'v' prefix from each tag
TAGS=$(echo "$TAGS" | sed 's/^v//g')
echo "::set-output name=stripped_tags::$TAGS"
- 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:09:59 +00:00
tags: ${{ steps.remove-v.outputs.stripped_tags }}
labels: ${{ steps.meta.outputs.labels }}