From af407068b6137767d0ee41adfdb80b18e96ead02 Mon Sep 17 00:00:00 2001 From: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com> Date: Sun, 4 Aug 2024 09:56:18 -0500 Subject: [PATCH] Fix workflows (#165) --- .github/workflows/dev.yaml | 79 -------------------- .github/workflows/main.yaml | 40 +--------- .github/workflows/{pr-merge.yaml => pr.yaml} | 45 +---------- .github/workflows/regular-tests.yaml | 44 +++++++++++ .github/workflows/release.yaml | 62 ++++----------- .github/workflows/tag.yaml | 24 ++++++ README.md | 64 ++++++---------- backend/version/version.go | 2 +- frontend/src/api/users.js | 1 - frontend/src/components/Search.vue | 9 ++- frontend/src/store/getters.js | 3 +- frontend/src/store/mutations.js | 1 - frontend/src/views/Files.vue | 1 - frontend/src/views/Layout.vue | 3 +- 14 files changed, 118 insertions(+), 260 deletions(-) delete mode 100644 .github/workflows/dev.yaml rename .github/workflows/{pr-merge.yaml => pr.yaml} (51%) create mode 100644 .github/workflows/regular-tests.yaml create mode 100644 .github/workflows/tag.yaml diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml deleted file mode 100644 index b3fc8e8c..00000000 --- a/.github/workflows/dev.yaml +++ /dev/null @@ -1,79 +0,0 @@ -name: dev - -on: - push: - branches: - - 'dev_v*' - -jobs: - test-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go test -race -v ./... - lint-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - uses: golangci/golangci-lint-action@v6 - with: - version: v1.59 - working-directory: backend - format-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go fmt ./... - lint-frontend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - working-directory: frontend - run: npm i eslint && npm run lint - - push_dev_to_registry: - name: Push dev image - 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 - 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@v5 - with: - images: gtstef/filebrowser - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e0eaae03..c6a29c5e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -3,48 +3,10 @@ name: main job on: push: branches: - - 'main' + - "main" jobs: - test-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go test -race -v ./... - lint-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - uses: golangci/golangci-lint-action@v6 - with: - version: v1.59 - working-directory: backend - format-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go fmt ./... - lint-frontend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - working-directory: frontend - run: npm i eslint && npm run lint - push_latest_to_registry: - needs: [lint-frontend, lint-backend, test-backend, format-backend] name: Push latest runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pr-merge.yaml b/.github/workflows/pr.yaml similarity index 51% rename from .github/workflows/pr-merge.yaml rename to .github/workflows/pr.yaml index 2c5a31b2..c7139ec9 100644 --- a/.github/workflows/pr-merge.yaml +++ b/.github/workflows/pr.yaml @@ -3,48 +3,11 @@ name: pr-merge on: pull_request: branches: - - 'main' - - 'dev_v*' - - 'v[0-9]+.[0-9]+.[0-9]+' + - "main" + - "v[0-9]+.[0-9]+.[0-9]+" + - "dev_*" jobs: - test-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go test -race -v ./... - lint-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - uses: golangci/golangci-lint-action@v6 - with: - version: v1.59 - working-directory: backend - format-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go fmt ./... - lint-frontend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - working-directory: frontend - run: npm i eslint && npm run lint - push_pr_to_registry: name: Push PR runs-on: ubuntu-latest @@ -78,4 +41,4 @@ jobs: file: ./Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/regular-tests.yaml b/.github/workflows/regular-tests.yaml new file mode 100644 index 00000000..e042f395 --- /dev/null +++ b/.github/workflows/regular-tests.yaml @@ -0,0 +1,44 @@ +name: dev + +on: + push: + branches: + - "*" + +jobs: + test-backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - working-directory: backend + run: go test -race -v ./... + lint-backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 + working-directory: backend + format-backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - working-directory: backend + run: go fmt ./... + lint-frontend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - working-directory: frontend + run: npm i eslint && npm run lint diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8bfbeb15..3f842c78 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,7 +3,7 @@ name: release on: push: branches: - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" permissions: contents: write @@ -14,63 +14,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT }} - name: Extract branch name shell: bash run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch + - uses: actions/setup-go@v5 + with: + go-version: 1.22.2 - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v2 with: + target_commitish: ${{ steps.extract_branch.outputs.branch }} + token: ${{ secrets.PAT }} tag_name: ${{ steps.extract_branch.outputs.branch }} - release_name: ${{ steps.extract_branch.outputs.branch }} - body: | - Please see usage on [readme](https://github.com/gtsteffaniak/filebrowser). - Docker repo: https://hub.docker.com/r/gtstef/filebrowser/tags - draft: false prerelease: false - test-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go test -race -v ./... - lint-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - uses: golangci/golangci-lint-action@v6 - with: - version: v1.59 - working-directory: backend - format-backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - working-directory: backend - run: go fmt ./... - lint-frontend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - working-directory: frontend - run: npm i eslint && npm run lint - + draft: false + generate_release_notes: true + name: ${{ steps.extract_branch.outputs.branch }} push_release_to_registry: - needs: [lint-frontend, lint-backend, test-backend, format-backend] name: Push release runs-on: ubuntu-latest steps: diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 00000000..0ed8d0c2 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,24 @@ +name: tag + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + update_tag: + name: Update Release tag + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + args: release --clean + workdir: backend + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 5d411b3a..120f1099 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@
-
+
-
-
-
-
-
+
+
+
+