diff --git a/.github/workflows/actions/test/action.yml b/.github/workflows/actions/test/action.yml new file mode 100644 index 0000000..f6f1dd7 --- /dev/null +++ b/.github/workflows/actions/test/action.yml @@ -0,0 +1,36 @@ +name: Test +description: Test the image + +inputs: + test-tag: + required: true + +env: + RAILS_ENV: development + +runs: + using: composite + + steps: + - uses: actions/checkout@v4 + with: + repository: redmine/redmine + ref: master + path: redmine + + - run: | + docker volume create redmine-bundle-cache + + cd redmine + cat < config/database.yml + development: + adapter: sqlite3 + database: db/development.sqlite3 + EOS + + docker run --rm -v ${PWD}:/redmine \ + -v redmine-bundle-cache:/bundle \ + -p 3000:3000 \ + ${{ inputs.test-tag }} \ + bash -c "bundle install && bin/about" + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..adda640 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build + +on: + push: + branches: + - main + paths-ignore: + - '**.md' + - 'redmined' + workflow_dispatch: + +env: + TEST_TAG: redmined:test + IMAGE_TAG: ghcr.io/hidakatsuya/redmined:latest + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-qemu-action@v3 + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and export to Docker for testing + uses: docker/build-push-action@v5 + with: + context: . + load: true + tags: ${{ env.TEST_TAG }} + + - name: Test + uses: ./.github/actions/test + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.IMAGE_TAG }} + diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index ce1cc82..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Docker - -on: - push: - branches: - - main - paths-ignore: - - '**.md' - - 'redmined' - - workflow_dispatch: - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - 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.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ghcr.io/hidakatsuya/redmined:latest