diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index bcf1841..02b119e 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -17,7 +17,7 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build - - run: | + run: | nix build .#package echo "PACKAGE_PATH=$(readlink -f result)" >>$GITHUB_ENV @@ -47,7 +47,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: - packages: write # For GitHub Container Registry contents: write # For GitHub Releases steps: - uses: actions/download-artifact@v3 @@ -81,9 +80,13 @@ jobs: - name: Package release run: | - tar cf ./dist/aws-exporter-$VERSION.linux-amd64.tar.gz \ + tar cf ./dist/aws-cost-exporter-$VERSION.linux-amd64.tar.gz \ -C ./dist/release . + chart=$(find ./dist/chart -type f | grep -o 'aws-cost-exporter-.*\.tgz') + echo "chart=$chart" + mv -v ./dist/chart/*.tgz ./dist/$chart + - name: Load image run: | docker load -i ./dist/image/*.tar.gz @@ -95,29 +98,17 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Push image - run: + run: | docker push $IMAGE_REPOSITORY:$VERSION - docker push $IMAGE_REPOSITORY:$VERSION $IMAGE_REPOSITORY:latest - - docker push $IMAGE_REPOSITORY:$VERSION \ - ghcr.io/$IMAGE_REPOSITORY:$VERSION - docker push $IMAGE_REPOSITORY:$VERSION \ - ghcr.io/$IMAGE_REPOSITORY:latest + docker push $IMAGE_REPOSITORY:latest - name: Create release uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 with: name: Release ${{ env.VERSION }} files: | - ./dist/aws-exporter-*.tar.gz - ./dist/chart/*.tgz + ./dist/aws-cost-exporter-*.tar.gz + ./dist/aws-cost-exporter-chart-*.tgz fail_on_unmatched_files: true generate_release_notes: true diff --git a/flake.nix b/flake.nix index 8b49c5d..580e313 100644 --- a/flake.nix +++ b/flake.nix @@ -4,18 +4,18 @@ version = "0.3.1"; chartVersion = "0.1.2"; vendorSha256 = "sha256-LZomE9j6m7TAPyY/sZWVupyh8mkt8MjwUnmbYzZoUP8="; - dockerPackageTag = "ghcr.io/st8ed/aws-cost-exporter:${version}"; + dockerPackageTag = "st8ed/aws-cost-exporter:${version}"; src = with lib; builtins.path { name = "aws-cost-exporter-src"; - path = sources.cleanSourceWith { + path = sources.cleanSourceWith rec { filter = name: type: let baseName = baseNameOf (toString name); in !( (baseName == ".github") || (hasSuffix ".nix" baseName) || (hasSuffix ".md" baseName) || - (hasPrefix "${./.}/chart/" name) + (hasPrefix "${src}/chart" name) ); src = lib.cleanSource ./.; }; @@ -142,6 +142,8 @@ package = nixpkgsFor."${system}".aws-cost-exporter; dockerImage = nixpkgsFor."${system}".aws-cost-exporter-dockerImage; helmChart = nixpkgsFor."${system}".aws-cost-exporter-helmChart; + + inherit src src-chart; }); }; }