From 97e3a640244a8d318967f63dc1d6cf195c69ce90 Mon Sep 17 00:00:00 2001 From: Drdada Date: Sat, 21 Oct 2023 10:03:01 +0000 Subject: [PATCH] First workflow --- .github/workflows/docker-publish.yml | 58 --------------------- .github/workflows/docker.yml | 76 ---------------------------- .github/workflows/publish-ghcr.yaml | 15 ++++++ .vscode/settings.json | 3 -- 4 files changed, 15 insertions(+), 137 deletions(-) delete mode 100644 .github/workflows/docker-publish.yml delete mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/publish-ghcr.yaml delete mode 100644 .vscode/settings.json diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 1b69229..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Docker - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -on: - push: - # branches: [main] - # Publish semver tags as releases. - tags: ['v*.*.*'] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')" - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository_owner }}/obsidian-remote - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 - with: - context: . - #file: ./Dockerfile - push: true # Will only build if this is not here - #tags: ghcr.io/${{ github.repository_owner }}/obsidian-remote:latest - # build-args: | - # "BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" - # "IMAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index c5cddcf..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Docker - -on: - workflow_dispatch: - schedule: - - cron: "0 0 * * 1" - push: - branches: - - latest - - main - paths-ignore: - - 'README.MD' - - '.github' - -jobs: - build: - name: build - runs-on: ubuntu-latest - - permissions: - packages: write - contents: read - - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - -# - name: Log in to the Container registry -# uses: docker/login-action@v3 -# with: -# registry: ghcr.io -# username: ${{ github.actor }} -# password: ${{ secrets.GIT_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote - - - name: Build and push Docker images - uses: docker/build-push-action@v5 - with: - context: . - file: dockerfile.amd64 - platforms: linux/amd64 - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote:latest - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote:buildcache_amd64 - cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote:buildcache_amd64,mode=max - -# - name: Build and push Docker images -# uses: docker/build-push-action@v5 - #with: - #context: . - #file: dockerfile.arm64 - #platforms: linux/arm64 - #push: true - #tags: ${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote:arm64 - #labels: ${{ steps.meta.outputs.labels }} - #cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote:buildcache_arm64 - #cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/obsidian-remote:buildcache_arm64,mode=max diff --git a/.github/workflows/publish-ghcr.yaml b/.github/workflows/publish-ghcr.yaml new file mode 100644 index 0000000..a0f49f1 --- /dev/null +++ b/.github/workflows/publish-ghcr.yaml @@ -0,0 +1,15 @@ +name: Docker image CI for GHCR + +on: + push + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build an push the image + run: | + docker login --username drdada --password ${{ secrets.GH_TOKEN }} ghcr.io + docker build . --tag ghcr.io/drdada/obsidian-remote:latest + docker push ghcr.io/drdada/obsidian-remote:latest diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 34dfacb..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "docker.languageserver.formatter.ignoreMultilineInstructions": true -} \ No newline at end of file