diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8a1f081 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Deploy +on: + push: + branches: main + +jobs: + release-on-push: + runs-on: ubuntu-latest + outputs: + ver: ${{ steps.release.outputs.version }} + tag: ${{ steps.release.outputs.tag_name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Get Release + id: release + uses: rymndhng/release-on-push-action@master + with: + bump_version_scheme: patch + - name: Check Release Output + id: rop-check + run: | + echo "Got tag name ${{ steps.release.outputs.tag_name }}" + echo "Got release version ${{ steps.release.outputs.version }}" + + build: + name: GitHub Container Registry + runs-on: ubuntu-latest + needs: [prepare-data] + steps: + - uses: actions/checkout@v2 + - name: Login to GitHub Container Registry + run: echo ${{ secrets.PAT }} | docker login ghcr.io -u luketainton --password-stdin + - name: Build image for GitHub Container Registry + run: docker build . --file Dockerfile --tag ghcr.io/luketainton/fhed:${{ needs.release-on-push.outputs.ver }} --tag ghcr.io/luketainton/fhed:latest + - name: Push image to GitHub Container Registry + run: | + docker push ghcr.io/luketainton/fhed:latest + docker push ghcr.io/luketainton/fhed:${{ needs.release-on-push.outputs.ver }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index a73703c..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy -on: - push: - branches: main - -jobs: - release-on-push: - runs-on: ubuntu-latest - outputs: - ver: ${{ steps.release.outputs.version }} - tag: ${{ steps.release.outputs.tag_name }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - id: release - uses: rymndhng/release-on-push-action@master - with: - bump_version_scheme: patch - - - name: Check Output Parameters - run: | - echo "Got tag name ${{ steps.release.outputs.tag_name }}" - echo "Got release version ${{ steps.release.outputs.version }}" - - docker-dh: - name: Push to Docker Hub - needs: [release-on-push] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Login to DockerHub Registry - run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - - name: Build image for Docker Hub - run: docker build . --file Dockerfile --build-arg VERSION=${{ needs.release-on-push.outputs.ver }} --tag luketainton/fhed:${{ needs.release-on-push.outputs.tag }} --tag luketainton/fhed:latest - - name: Push image to Docker Hub - run: | - docker push luketainton/fhed:${{ needs.release-on-push.outputs.tag }} && - docker push luketainton/fhed:latest - - docker-ghr: - name: Push to GitHub Package Registry - needs: [release-on-push] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Login to DockerHub Registry - run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u luketainton --password-stdin - - name: Build image for GitHub Package Registry - run: docker build . --file Dockerfile --build-arg VERSION=${{ needs.release-on-push.outputs.ver }} --tag docker.pkg.github.com/luketainton/fhed/fhed:latest --tag docker.pkg.github.com/luketainton/fhed/fhed:${{ needs.release-on-push.outputs.tag }} - - name: Push image to GitHub Package Registry - run: | - docker push docker.pkg.github.com/luketainton/fhed/fhed:${{ needs.release-on-push.outputs.tag }} && - docker push docker.pkg.github.com/luketainton/fhed/fhed:latest - - deploy: - name: Update Docker image on server - runs-on: ubuntu-latest - needs: [docker-dh] - steps: - - name: Update image on server - uses: garygrossgarten/github-action-ssh@release - with: - command: cd /docker/active/fhed && docker-compose pull && docker-compose up -d - host: ${{ secrets.SSH_HOST }} - port: ${{ secrets.SSH_PORT }} - username: ${{ secrets.SSH_USERNAME }} - privateKey: ${{ secrets.SSH_SSHKEY }} diff --git a/Dockerfile b/Dockerfile index 80c0cce..b1f343f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ RUN composer --working-dir=/srv install FROM php:apache LABEL maintainer="Luke Tainton " +LABEL org.opencontainers.image.source="https://github.com/luketainton/fhed" ARG VERSION RUN docker-php-ext-install pdo_mysql && a2enmod rewrite remoteip COPY vhost.conf /etc/apache2/sites-enabled/000-default.conf