wip: 🔕 temporary commit

This commit is contained in:
Paramtamtam 2024-06-29 20:06:06 +04:00
parent 6766f3f787
commit b7ed431c8f
No known key found for this signature in database
GPG Key ID: 366371698FAD0A2B
2 changed files with 56 additions and 74 deletions

View File

@ -14,91 +14,70 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [linux, darwin] # linux, freebsd, darwin, windows
arch: [amd64] # amd64, 386
os: [linux, darwin, windows] # freebsd
arch: [amd64, arm64] # 386
steps:
- uses: actions/checkout@v4
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}
- {uses: actions/setup-go@v5, with: {go-version-file: go.mod}}
- {uses: gacts/github-slug@v1, id: slug}
- name: Generate builder values
id: values
run: echo "binary-name=error-pages-${{ matrix.os }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
- name: Build application
env:
- id: values
run: echo "binary-name=error-pages-${{ matrix.os }}-${{ matrix.arch }}`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`" >> $GITHUB_OUTPUT
- env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
LDFLAGS: -s -w -X gh.tarampamp.am/error-pages/internal/version.version=${{ steps.slug.outputs.version }}
run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/error-pages/
- name: Upload binary file to release
uses: svenstaro/upload-release-action@v2
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.values.outputs.binary-name }}
asset_name: ${{ steps.values.outputs.binary-name }}
tag: ${{ github.ref }}
# docker-image:
# name: Build docker image
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
#
# - {uses: gacts/github-slug@v1, id: slug}
#
# - uses: docker/setup-qemu-action@v3 # Action page: <https://github.com/docker/setup-qemu-action>
#
# - uses: docker/setup-buildx-action@v3 # Action page: <https://github.com/docker/setup-buildx-action>
#
# - uses: docker/login-action@v3 # Action page: <https://github.com/docker/login-action>
# with:
# username: ${{ secrets.DOCKER_LOGIN }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - uses: docker/login-action@v3 # Action page: <https://github.com/docker/login-action>
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - uses: docker/build-push-action@v5 # Action page: <https://github.com/docker/build-push-action>
# with:
# context: .
# file: Dockerfile
# push: true
# platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8
# build-args: "APP_VERSION=${{ steps.slug.outputs.version }}"
# tags: |
# tarampampam/error-pages:${{ steps.slug.outputs.version }}
# tarampampam/error-pages:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
# tarampampam/error-pages:${{ steps.slug.outputs.version-major }}
# tarampampam/error-pages:latest
# ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
# ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
# ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}
# ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:latest
#
# demo:
# name: Update the demonstration
# runs-on: ubuntu-latest
# needs: [docker-image]
# steps:
# - {uses: gacts/github-slug@v1, id: slug}
#
# - name: Take rendered templates from the built docker image
# run: |
# docker create --name img ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
# docker cp img:/opt/html ./out
# docker rm -f img
#
# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v4
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./out
docker-image:
name: Build the docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- {uses: gacts/github-slug@v1, id: slug}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8
build-args: "APP_VERSION=${{ steps.slug.outputs.version }}"
tags: | # TODO: add `tarampampam/error-pages:latest` and `ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:latest`
tarampampam/error-pages:${{ steps.slug.outputs.version }}
tarampampam/error-pages:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
tarampampam/error-pages:${{ steps.slug.outputs.version-major }}
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version-major }}
demo:
name: Update the demo (GitHub Pages)
runs-on: ubuntu-latest
needs: [docker-image]
steps:
- {uses: gacts/github-slug@v1, id: slug}
- run: |
docker create --name img ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
docker cp img:/opt/html ./out
docker rm -f img
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out

View File

@ -83,10 +83,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- {uses: gacts/github-slug@v1, id: slug}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: false
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8
build-args: "APP_VERSION=${{ steps.slug.outputs.commit-hash-short }}"
tags: app:ci