Skip to content

Use single click for email selection (#837) #29

Use single click for email selection (#837)

Use single click for email selection (#837) #29

Workflow file for this run

name: Releases
on:
push:
tags:
- "v*"
jobs:
release:
name: Release on GitHub
if: github.repository_owner == 'harryzcy'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Publish Release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
})
let releaseId = null;
for (const release of releases) {
if (release.draft) {
releaseId = release.id
break
}
}
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
tag_name: '${{ github.ref_name }}',
name: 'Release ${{ github.ref_name }}',
draft: context.eventName != 'push'
})
release-docker:
name: Release on Docker Hub
if: github.repository_owner == 'harryzcy'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4
with:
node-version: 20
# When building for arm/v7, npm install will fail
# so let's build the frontend outside of the docker build
- name: Build frontend
run: make build-web
- name: Get build variables
run: |
# shellcheck disable=SC2129
echo "BUILD_COMMIT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
# shellcheck disable=SC2129
echo "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_ENV"
# shellcheck disable=SC2129
echo "BUILD_VERSION=$(git describe --tags --always)" >> "$GITHUB_ENV"
- name: Check build variables
run: |
echo "$BUILD_COMMIT"
echo "$BUILD_DATE"
echo "$BUILD_VERSION"
- name: Docker meta
id: meta
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c # v5
with:
images: |
harryzcy/mailbox-browser
ghcr.io/harryzcy/mailbox-browser
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3
- name: Login to DockerHub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5
with:
context: .
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_COMMIT=${{ env.BUILD_COMMIT }}
BUILD_VERSION=${{ env.BUILD_VERSION }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}