Skip to content

Handle missing origin in response handlers. #37

Handle missing origin in response handlers.

Handle missing origin in response handlers. #37

Workflow file for this run

# Displays in the badge in Readme.md
name: Latest Container Build
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: write
packages: write
id-token: write
env:
CARGO_TERM_COLOR: always
GITHUB_REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
rust:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
run: |
rustup update stable && rustup default stable
cargo -V
- name: Build
# Make sure to remove the temporary built artifacts so that don't end up in the container causing container build to take longer
run: |
cargo build --release --example server # --verbose --frozen
cargo test --verbose
rm -rf ./target
- name: Create Github Release and Tag
if: github.repository_owner == 'Authress' && github.event_name == 'push'
run: |
branchRef="${GITHUB_REF/refs\/heads\/release\//}"
branchId="${branchRef/refs\/heads\//}"
export VERSION="${branchId/main/0.0}.${GITHUB_RUN_NUMBER:-0}"
sed -i "s/0.0.0/${VERSION}/g" ./Cargo.toml -i
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo Building version: ${{ env.VERSION }}
git tag $VERSION
git push origin $VERSION
- name: Configure container metadata
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
if: github.repository_owner == 'Authress' && github.event_name == 'push'
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ env.VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
type=semver,pattern={{major}},value=${{ env.VERSION }}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: GitHub - Container registry login
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
if: github.repository_owner == 'Authress' && github.event_name == 'push'
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: DockerHub - Container registry login
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
if: github.repository_owner == 'Authress' && github.event_name == 'push'
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.DOCKER_HUB_REGISTRY }}
username: authress
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and push Docker image
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
if: github.repository_owner == 'Authress' && github.event_name == 'push'
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}