diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ba02ec4..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 -jobs: - test: - docker: - - image: golang - steps: - - checkout - - run: - name: Run tests - command: go test ./... - build: - docker: - - image: docker:stable - steps: - - checkout - - setup_remote_docker - - run: - name: Build Docker image - command: | - docker build \ - --no-cache \ - -t spaceapi/validator:latest \ - -t spaceapi/validator:${CIRCLE_BRANCH} \ - . - - deploy: - name: Push Docker image - command: | - docker login -u $DOCKER_USER -p $DOCKER_API_KEY && \ - docker push spaceapi/validator -workflows: - version: 2 - - # Build on push to master - on_push: - jobs: - - test - - build: - requires: - - test - filters: - branches: - only: - - master - - # Build every week on Monday at 05:00 am - weekly: - triggers: - - schedule: - cron: "0 5 * * 1" - filters: - branches: - only: - - master - jobs: - - test - - build: - requires: - - test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b5ee193 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ + +on: + push: + branches: + - master + schedule: + - cron: "0 5 * * 1" + +name: publish + +jobs: + test: + name: Build Docker image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build validator image + run: | + docker build \ + --no-cache \ + --tag ghcr.io/spaceapi/validator:latest \ + --tag ghcr.io/spaceapi/validator:$GITHUB_REF_NAME \ + --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ + . + - name: Publish validator image + run: | + docker push -a ghcr.io/spaceapi/validator diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..43a3515 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ + +on: push + +name: test + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup latest Go + uses: actions/setup-go@v5 + with: + go-version: stable + - name: Run tests + run: | + go test ./... diff --git a/README.md b/README.md index c3fe1a0..1700004 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ be dual licensed as above, without any additional terms or conditions. [circle-ci]: https://circleci.com/gh/SpaceApi/validator/tree/master [circle-ci-badge]: https://circleci.com/gh/SpaceApi/validator/tree/master.svg?style=shield -[docker-image]: https://hub.docker.com/r/spaceapi/validator/ -[docker-image-badge]: https://img.shields.io/docker/pulls/spaceapi/validator.svg +[docker-image]: https://github.com/SpaceApi/validator/pkgs/container/validator +[docker-image-badge]: https://img.shields.io/badge/container%20image-ghcr.io/spaceapi/validator-blue.svg [go-report-card]: https://goreportcard.com/report/github.com/spaceapi/validator [go-report-card-badge]: https://goreportcard.com/badge/github.com/spaceapi/validator